Player walks/stops toggle

hi there, here´s another one :wink:

I´ve got a sidescroller player character (for mobiles, means which touch input) who walks automatically from left to right.

I want this to happen:

  • when I touch once, he should jump
  • when I touch twice (or better said, “double tap”), he should stop and go along again when I re-double tap.

I´ve come along to this point (see below picture), but for some reason he jumps also when I double tap, after he stopped.

I feel I am close to the solution but can´t figure it out…

any hints?


Because a double tap is still a tap. So it’s going to do that as well.

You have a sequence in there so it will run through both of those things without anything stopping it from jumping.

You will want to do another check after your delay to see if the click number was higher, or set a variable from your double tap and check if its false before triggering your jump. Still seems like it will be prone to error either way or you will have a delay before you jump all the time which is unlikely something that you want.

Have one half of the screen be the “tap to jump” part, and the other half be the “tap to stop/go” part instead?

@ 6ixpool: How would you do that? can you define which “region” of the screen can be touched?