I've searched through old topics, but none of the given advice works (at least using MMF).
Basically, I need my character to run while pressing right, and do a faster run if right is double tapped. I've tried both flags and values, but it always goes immediately to the "faster run". So I tried several limitations and it works... almost.
Here are my current events (for right direction only):
*Upon pressing right
+Delta X < or = 0: Set Direction to Right, Set Delta X to 0, Set value C to 20.
+C > 0: Sub 1 from C
*Upon pressing right
+C > 0
+Animation "Running" is playing
+Direction = left (negated): Set D to 1
*D = 1: Set Delta X to 10, Change animation sequence to "faster running"
*Repeat while right arrow is pressed (negated): Set D to 0
But there are still quite a few problems.
- If his acceleration is greater than 0, you can keep tapping it and his C value will never be set. This one is obvious and I should be able to figure it out, but I can't think of any solutions right now.
- Sometimes, even if his acceleration is 0, and I tap right, his C won't be set.
- If I'm running left and then tap right, he immediately does the faster run. This seems to be just like the initial problem, in that the events are played simultaneously. The running animation restriction prevents bugs in the right direction, but because he is already in the running animation in this case, pressing right sets his direction to right, his C to 20 and his D to 1.
Am I missing something? Or do I just need to scratch this and try something else?
I have trouble with this same thing. I guess maybe you could have a "cooling down" period stored as a variable after the player releases the arrow keys? If the player presses the same arrow key again while this cooling down variable was still viable then you could give him the faster animation and speed? You'd have to make the cooling down period really short though. Just an idea.
EDIT: Nevermind, all that code I just wrote makes no sense whatsoever, sorry
Edited by the Author.
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
I haven't really taken the time to read any of the above, but you could noobishly use a textbox when the 'right' key is pressed, insert "r" in to the (hidden) textbox - when the value of the box is "rr" you can initiate the full speed, and say when value is "rr" and no keys are pressed then reset the box..
and also reset the box every x amount of seconds so that your player doesn't run if you press right twice at times when you may not want him to run.. etc.
the delay for resetting the textbox would need testing to find out exactly something reasonable.. but probs around .60 seconds should do? :\
try that anyways.. quite an easy way of doing things.
axel: Ah, thanks for the clarification. I thought I had tried changing the order, but I guess I hadn't. Definitely works now. Thanks. (Still conflicts with the engine somewhat, but that can be worked out.)