How do I make jump high depends on touch duration

Get help using Construct 2

Post » Sun Jul 13, 2014 6:11 pm

I want to create jump'n'run game and allow the player to jump only by touching somewhere on the screen. But it performs always the same high jump.

Is it possible to let the player jump short if the play touch and release the screen fast? And if he is touching longer the jump will higher (till the amount of the set jumpstrength.

Is this possible? If yes, know anybody how?

Thanks.

Here is the live HTML5 demo.
http://envato.wdbase.de/wp-content/demo/runner/
Image Image iTunes: Match3 | Google Play: Match3
B
100
S
35
G
30
Posts: 1,136
Reputation: 28,085

Post » Sun Jul 13, 2014 9:31 pm

Hi, try this. IMHO, make instance variable for background & name it "jump" then set event: When touch on touching background, every 1 sec ==> action: add 1 to background.jump
then add, if touch released, if jump = X value ==> action set player platform strength to any value.
So for each X jump value , different jump heights. Hope it helped!
ImageImageImageImageImage
B
56
S
15
G
5
Posts: 852
Reputation: 11,436

Post » Mon Jul 14, 2014 8:59 am

This is easy, no variables needed
touch > on any touch start > simulate "player" platform movement jump
touch > on any touch end & player.platform player is falling (inverted so player isnt falling) > set player Y vector to 0

basically the inverted player is falling action will make it so you cant just tap over and over to get some hang time in the air.
done and done.
B
26
S
7
G
1
Posts: 83
Reputation: 2,575

Post » Mon Jul 21, 2014 5:10 pm

Thanks to both of you :) I'll try it and let you know ;)
Image Image iTunes: Match3 | Google Play: Match3
B
100
S
35
G
30
Posts: 1,136
Reputation: 28,085


Return to How do I....?

Who is online

Users browsing this forum: Armench and 16 guests