hey guys!
here's a quick tutorial about the the typical Mario jump, low-jump & high-jump
- & no jetpack effect!
i needed this effect last night for a small side-project but could not easily find a good answer.
but it was actually very easy! (so I'll get started!)
-The basic Setup: Floor & Background.
-You create a floor: (insert Sprite, Add Solid behavior)
(my quick-drawn floor has invisibility on top, change the collision model in the image editior-)
(also notice how the floor should be in Layer: "Game" , so will the character/Enemies/etc.)
p.s.: i like having a blue background so you can see everything clearly.
- Add the Character & his basic settings.
*-Add a sprite & give him a Solid Behavior & platform Behavior.
(the following settings could be different for you,
but you'll have to play & add minimal changes anyways because otherwise your platformer won't ever feel good.
PlayerSprite Behavior Settings:
-Max Speed: 300
-Acceleration: 1500 (Default)
-Deceleration: 1500 (Default)
-Jump Strength: 500
-Gravity: 850
-Max Fall Speed: 1000
Default Controls: no (forgot to toggle in the image!)
(Also: add keyboard/Touch! )
- Adding the right Jumping Behavior!
Where the fun happens!
i'll try to explain this in Text as good as possible:
1 - Keyboard - on UP pressed:
PlayerSprite - Simulate Platform Pression jump &
Playersprite - Set Platform Gravity to 850
2 - Keyboard - on UP Released:
Playersprite - Set Platform Gravity to 1500
3 - PlayerSprite - Platform On landed:
Playersprite - Set Platform Gravity to 850
4 - Finally: you can add:
PlayerSprite - Platform is Falling:
PlayerSprite - Set Gravity to 1500
Explanation on the above code:
1: Up arrow makes the Character Jump & Gravity is Lowered to 850 (less gravity is more jump)
2: Up arrow released = Reset settings to default: strong gravity so the player falls down, and not hover!
3: Player landed: you might want him to have a low or higher gravity set when walking (play testing for your game)
4: while falling (and this happens right after the Zero-gravity point of the jump): you can give the player a falling animation here, of make him fall faster by increasing the gravity to 1500, or hover him down with something low like 500.
I Hope the tutorial is usefull, let me know if there's anything to change, suggestions, tips..
-LolindirLink
-LL