Double touch based jump

0 favourites
  • 5 posts
From the Asset Store
Advanced inventory mechanics for your RPG game (Array-based). Take Items, split them, pick up them, read the description
  • Hi,

    I am trying to implement jump behaviour for a platformer with touch.

    Instead of having a HUD, I'd like the user to simply double tap on left half of the screen to jump left or right half to jump right.

    Currently I have player left/right moving working the same way with user touching either left/right half of screen... but I dont see a event like "is double touching/multiple touching".

    Anyone got around this?

    Looking for pointers.

    Thank you :)

  • Maybe use a global variable that is incremented each time a touch is detected and reset the variable to 0 every half second.

    If the variable is greater than or equal to 2 then it's a double touch.

    Example: dl.dropbox.com/u/90589590/DoubleTapJump.capx (r105)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wow I was thinking on similar lines headbanging yesterday.

    But looking at the touch count, it looked like touch starts counting from the first touch and I was wondering how I'd classify something as double touch.

    Was thinking of having a variable that will record time between each touch and compare touch n and touch (n-1) .. although I still don't know if I can pull time in secs or unixtime into a variable.

    Too complex eh :)

    So the magic is "reset the variable to 0 every half second."

    Thank you OddConfection

    Btw, any use of why the touch gets counted and are we actually breaking something internally if we reset it? Ashley?

    May be I should assign the value to another variable and use that.

  • OddConfection

    Thanks a ton for the example mate. :)

  • They should put this at the top of the Scirra website...

    "When in doubt, use global variables."

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)