How to change jump intensity according to tap intensity
davidsalomon
Member Posts: 136
Hello everyone, can someone help me out how can I change the jump intensity (self.Motion.Linear Velocity.Y) according to the intensity of the tapping of the user? Just like the ePig Dash.
Comments
When jump is True: change attribute
self motion linear velocity Y to +y (y is the number of your choise).
When jump is false: interpolate behaviour
self motion linear velocity Y to -y (y is the number of your choise).
Or when jump is false: accelerate behaviour
orientation: 270, speed: y (y is the number of your choise).
The problem with the interpolation is: when you will release jump button, if the interpolation time is too long, your character will continue to go higher for a little time.
The probleme with accelerate behavior is: when you release jump button your character may go down too roughly.
It depend of what you are looking for your gameplay: something smooth use interpolate behaviour.
If you want something precise (maybe too precise) use accelerate behaviour.
But maybe some one have an other way to do it.
Have a nice day.
Try this:
In your hero add an acceleration rule in downwards direction(270) at a speed on 1000.
Create a jump button actor and make an interger attribute called jump.
In your jump button make a rule:
WHEN - mouse button is down
DO -Change attribute jump to 1, else change attribute jump = 0
In your hero make a rule:
WHEN - jump = 1
DO - Change velocity in upwards direction(90) at a speed of 600
ELSE - Change velocity in downwards direction(270) at a speed of 200
You might have to play around with those numbers to find what suits you best. Or maybe someone can give you a better solution. Good luck
@Kyukon: What I mean is that if the user taps the jump button "weak" then the hero will jump a little. But if the user taps the jump button "hard" then the hero will jump more, and if the user taps it "harder" then the hero will jump a lot.
Should I play with timers? Any advices?
Also what @kloo13 said is just an alternative version of what I said.
I think I will have to experiment according to the milliseconds that the finger is in the jump button to simulate the strength that the hero uses to jump.
I'll see if I come out with something with timers.
Depending if the press is between 0<x<0.5 or 0.5<x<1 .. Something like that.