The Daily Click ::. Forums ::. Klik Coding Help ::. "Double tap running"?
 

Post Reply  Post Oekaki 
 

Posted By Message

sententia



Registered
  20/09/2005
Points
  162
18th November, 2007 at 12:00:15 -

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.

*Always
+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?

Image Edited by the Author.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
18th November, 2007 at 12:27:46 -

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

Image 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!

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
18th November, 2007 at 16:17:34 -

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.

 
http://www.SilverNova.co.uk


\/\/olf

Creative Genius

Registered
  06/08/2005
Points
  76

VIP Member
18th November, 2007 at 18:06:04 -

hey, thats a pretty decent technique. one can make combos with that pretty easily.

 
Image

www.OldMansTale.net
Sign the Petition! Go go Go!!

sententia



Registered
  20/09/2005
Points
  162
18th November, 2007 at 18:51:59 -

Thanks for the advice; I think I was trying too hard.

I'm now trying something similar to what Mr SilverNova suggested (although it can just use an alt value).


*Upon pressing right arrow: Add 1 to C

*C = 2: Set Delta X to 10 (faster), change animation to "faster run"

*Repeat while right arrow is pressed (negated)
+Animation running is playing (negated): Set C to 0



Much simpler.

 
n/a

\/\/olf

Creative Genius

Registered
  06/08/2005
Points
  76

VIP Member
19th November, 2007 at 03:08:43 -

yep, but what mr. silvernova said can be used for some advanced shite. a special move, combo n wt not. but whatever works is good

 
Image

www.OldMansTale.net
Sign the Petition! Go go Go!!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
19th November, 2007 at 07:42:49 -

* Counter is greater than 0
- Subtract 1 from Counter

* Upon pressing right
* Counter is greater than 0
- (Dash!)

* Upon pressing right
* Counter equals 0
- Set counter to 10


That's how I'd do it. Please note the event order: Event 3 has to come after event 2, otherwise it won't work.

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
19th November, 2007 at 07:42:54 -

(Double post)

Image Edited by the Author.

 
n/a

~Zigzag~



Registered
  13/03/2007
Points
  292

Game of the Week WinnerSilverNova Member
20th November, 2007 at 01:10:31 -

Yeah, but use an Alterable value and and always add to it instead of seconds. It's less buggy with lag & stuff.

 
http://www.SilverNova.co.uk

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
20th November, 2007 at 02:01:28 -

Yeah, that's the technique I would use for fighting games too - most definitely

edit: ... my one

Image Edited by the Author.

 
http://www.SilverNova.co.uk


sententia



Registered
  20/09/2005
Points
  162
20th November, 2007 at 14:48:57 -

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.)

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
20th November, 2007 at 15:31:26 -

In reference to silvernova's post. For a fighting game, you could simply reset the string when the player hits an attack button.

 
Craps, I'm an old man!

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
20th November, 2007 at 15:58:05 -

Yeah, if you wanted to use a seperate button to attack? :\ .. If that's what you mean

 
http://www.SilverNova.co.uk


Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
20th November, 2007 at 16:35:20 -

well using directions to attack in a fighting game (SF2 or KoF style anyway) would be rather pointless.

 
Craps, I'm an old man!

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
20th November, 2007 at 16:52:49 -

I'm not sure we both really understand eachother here so "I'm out" lol, nevermind

 
http://www.SilverNova.co.uk

   

Post Reply



 



Advertisement

Worth A Click