Hello guys,
I am working on an endless runner where i need my hero to jump from rock to rock (rock changes in length randomly. I am using physics for collisions (hero to rocks and hero to flying obstacles) I am trying to figure the best way to implement a jump I am not too worry about the logic of the single/double jump. I am mostly having hard with the jump itself. I have a look at many endless runner games and most of them have a nice and smooth jumps. I tried just using applyLinearImpulse inside a touch event (so every time the player touch the screen, the hero gets a upward force and then with a timer later on gets an downward force. That seems to be a little too jumpy.
I also try the same impulse method but within a enterFrame. I detect a screen touch and I set variable (touchFlag) to true or false. The enterFrame then apply a force either upward or downward. It is much smoother but I do not want the player to simply keep his/her finger on the screen and stay in the air the all time!
I was wondering if someone could suggest a better to approach this problem. To help visualize what I am looking for, maybe you can check the following two apps:
I like how smooth the hero’s jump:
https://itunes.apple.com/us/app/alien-life-race-anti-gravity/id606601428?mt=8
I like the double jumps in this game:
https://itunes.apple.com/us/app/disco-style-runner-free-saturday/id581348057?mt=8
THANK YOU!
Mo
ps: I am also not sure how density affect the movement. I also assuming that setting the hero bounce to zero means the hero will not bounce when hitting the rocks down below (or in the top of the screen)?