Double Jumping
oxhey
Member Posts: 28
I have a character who can jump an unlimited number of times.
I want to make it so that it can only jump twice ( jump then , boost jump) before it needs to touch the ground so it can jump again.
My current code for the character is this :
When atribute (game.jump) = true
change (self.Motion.Linear Velocity.Y) to 450
I want to make it so that it can only jump twice ( jump then , boost jump) before it needs to touch the ground so it can jump again.
My current code for the character is this :
When atribute (game.jump) = true
change (self.Motion.Linear Velocity.Y) to 450
Best Answers
-
master200012 Posts: 372Make an attribute (integer) within the actor who is jumping. Call it "jumps."
When the actor is overlapping or colliding with the ground,
constrain attribute (jumps) to 0
-----
Now for your code.
-----
When attribute (game.jump) = true
AND attribute (self.jumps) < 2
change (self.Motion.LinearVelocity.Y) to 450
Hope this helps! -
JohnPapiomitis Posts: 6,256
Make an attribute (integer) within the actor who is jumping. Call it "jumps."
No need for a constrain, you can just use a change attribute to change jumps back to 0 when he hits the ground.
When the actor is overlapping or colliding with the ground,
constrain attribute (jumps) to 0
-----
Now for your code.
-----
When attribute (game.jump) = true
AND attribute (self.jumps) < 2
change (self.Motion.LinearVelocity.Y) to 450
Hope this helps!
And you want it to be when jump is true and jumps < 2
change attribute jumps to jumps+1
change self motion linear velocity y to whatever