So, basically what I want to do is implement a floating jump for my character in this way:
- Have character be able to jump with the same gravity as my default Mario
- Make character float after jumping while holding down a specific key/button and be able to move horizontally for a given amount of time, then land back on the ground.
- Make it so that if the “float” button is not held, the character will simply jump normally.
(Basically the Princess Toadstool mechanic from Super Mario Bros. USA)
Hello, MiguelPescado!
You don’t need change the gravity for this. Look:
![gif](https://forum.gdevelop.io/uploads/default/original/3X/5/a/5a100d49bb0dcde50b9d8098c6aef965ee55d38d.gif)
Not quite… I want it to be like in SMB2:
![ezgif.com-gif-maker](https://forum.gdevelop.io/uploads/default/original/3X/8/b/8b5ca8eb14a4817d76368a1e28a4138b220d449f.gif)
Sorry, the memory I had was that she was falling slowly. I made the changes. See if it now works properly:
In this example it is only possible to float when the princess is falling, but not when she is jumping. In your case would you like her to abort the jump and start floating even while she is jumping?
Thanks, but I really don’t understand the snippet of code you have here… how do you even make boolean variables, and how do you even access the parameter “If one/all of these conditions are true”?
(I’m very much a noob at this, so sorry if it seems like my understanding is too basic)
To answer your question, I want to make it so that she’ll float when holding down a certain key if she jumps AND if she walks/runs off of a platform. So, she’d be able to float from a jumping start if that key is held down, but also if it is held down while she is falling off a platform. In addition, if that key is NOT held down, she’ll simply do a normal jump.
Also. you’re not wrong, Peach did have the floating ability changed to her falling slowly in both the Smash series and Super Mario 3D World, but in SMB2, it was as I showed, and I wanted to keep that NES-type feel intact.
Somehow in messing with my base movement code, I did it, exactly as I had envisioned!
1 Like
This boolean variable I created inside the object “Princess” in scene editor:
But you can create variables just through events. You just need assigned a value. So, the Princess Object only have the Boolean variable called “Float” as I showed in the previous screenshoot, right? But if I make something like this in the events:
Then, in beginning of the scene Gdevelop will create a instance variable for Princess called HitPoints with the value 20.
For more information about variables you can read the wiki (this link have a video of oficial youtube channel teaching about variables too): Variables - GDevelop documentation
With the condition AND. Is used within the OR condition. Example:
With this below event if Princess is falling OR Princess is on floor, then the animation will change to 1, right?
But sometimes we want to more then 1 condition be true inside of a OR. So, we can add this condition AND:
Here with AND, if Pricess is falling OR Princess is on floor + a key is released than the animation will change to 1:
I hope I have been able to clarify some of your doubts.
Glad you did! Next time I will structure the events in a simpler way taking into account that some users are new. Good lucky with your project! ![:v: :v:](https://forum.gdevelop.io/images/emoji/apple/v.png?v=12)
1 Like