Trouble with limiting actor jumping once
Belwas
Member Posts: 22
Hi all,
I have my jump code set like so:
When key (w) is pressed, do
Timer (0.5 seconds) run to completion (unchecked)
Accelerate (90 degrees) relative to (actor)
with acceleration (3500)
I am having trouble limiting the actor to jump only when contact with floor or walls. I want the jump height to be adjustable so cannot check the 'run to completion' and add in the usual jump boolean after the jump has finished.
Comments
No one knows?
Try using a boolean set so when It is false let him jump and change boolean to true...That way they cant keep jumping ...The set it so when the actor touches the ground of wall the boolean gets changed back to false. Letting him jump again.
This doesn't work as the actor immediately stops jumping when it leaves the floor as the jump isn't for a fixed time
Ok...set it as follows... (If you are using a button to jump)
When touch is pressed and Boolean(lets say Jump) is false turn
Jump to true..
Now in the actor that you want to jump set as follows...
Rule: When jump is true start Timer for 0.5 seconds(or as long as u want) move actor in the direction up...then let gravity pull him back down or have him move down....then when actor touches ground or wall change jump back to false...
So when you touch the button it will make you actor "jump" for 0.5 seconds. Then he will fall unless he touches the wall or ground then you can jump again...
I have a tutorial below that covers one way of doing single and multiple jumps if you want to check it out:
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I've finally worked it out by simply adding an extra rule with another timer
Thank you for your suggestions, I will try those both out too when I get on the computer