Set the jump so it can only be used once
Luiscri
Member Posts: 40
in Help Wanted
Hi, I have introduced the jump option in my game by the "Change attribute > linear velocity > Y", when I press the space button, but the problem is that whenever I press it, the character jump, and that can be done as many times as you want. I would like that the jump could only be used once until you touch the floor or the platform again. How can I do that?
Thank you for your answers.
Comments
Add a second condition to your jump rule that also checks to make sure the player is touching your ground platform in addition to pressing the space bar.
If you need a tutorial see:
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Do I use the collision behavior or should I use another one? Srry for asking but Im new on this.
Thank you by the way dude
EDIT: Using the collision behavior the character doesnt jump at all, its as if he was shaking. Which one should I use?
Set up a rule something like:
That is not real code of course since I don't know your actors names.
The tutorial posted shows it in detail if you need more information.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I used that rule but the problem is that as while you are jumping the character is not overlaping or colliding the platform it stop jumping and fall to the platform again altough you are pressing the space button. I dont know if I have explained myself.
Can you tell me the minute where its explained in the video you added? English is not my native language so I have some troubles on following the video.
Thank you so much.
Here is a sample project, the player will only jump when it is touching the platform. If you are using the windows version and not able to open this mac file, here is a screen shot of the behaviors on the player. The main behavior of interest is the rule and it's conditions.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
The picture didn't upload, here it is...
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
That was what I set, but I repeat that with that behaviors the character doesnt jump at all, it only does a kind of shake because with that set when the actor (character in this case) stop being in contact with the platform it also stop jumping because the condition "ovelap or collide with platform" stops happening. Another idea of how can I make it?
EDIT: Ok, I managed to do it. The problem was that you have to consider on the initial condition the buttons being up for a 0 velocity, and set the movement on the "else/otherwise" section. Its explained on the video jamie_c added on the minute 9-11. Thank you for the help.