Double touch based jump

Get help using Construct 2

Post » Thu Oct 04, 2012 2:17 pm

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 :)
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627

Post » Thu Oct 04, 2012 6:14 pm

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: https://dl.dropbox.com/u/90589590/DoubleTapJump.capx (r105)OddConfection2012-10-04 18:22:54
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
27
S
7
G
4
Posts: 314
Reputation: 4,928

Post » Fri Oct 05, 2012 8:27 am

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.
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627

Post » Tue Oct 30, 2012 10:59 pm

@oddconfection

Thanks a ton for the example mate. :)
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627

Post » Wed Oct 31, 2012 1:48 am

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

"When in doubt, use global variables."
B
14
S
5
G
4
Posts: 121
Reputation: 3,938


Return to How do I....?

Who is online

Users browsing this forum: gumshoe2029 and 26 guests