2D Platformer Controls in Godot Engine
This is my attempt to crate tight 2D platformer controls in Godot engine.
I added html game so you can try it before you download. Hope you like it.
I commented in code and tried to explain what every function does.
It has gamefeel features like if you press jump button slightly earlier, player jumps when it touches the ground.
It also has a part where you can change jump counts and make it double (or more) jumps
It features full animation codes and images that represents what animation are playing. You can change them with your animation sprites and It should work well
It has tileset with godot logo tile in it so you can change level layout easily.
Update V2: I changed some code and removed the ability to jump anywhere after you fall, there is now coyote jump instead. I changed godot logo tiles to square blue ones so game looks better now (I guess) I improved walljumps but they are not as good as I wanted so there will probably a wall jump update on future
I tried to upload it in Github. I am not sure if I made everything right but you can git clone the source code with this github link.
Github link: https://github.com/Ozzymandias0/developer-thingies
Status | Released |
Category | Assets |
Author | Ozzymandias0 |
Genre | Platformer |
Tags | 2D, controls, gdscript, Godot |
Download
Click download now to get access to the following files:
Comments
Log in with itch.io to leave a comment.
This has been so helpful for me. Thank you!
Your latest releases should be above previous releases, not the other way around. Cool script though, I will certainly play with it.
Oh, I didn't know that. Thanks for your notice
thanks, that's a huge help for a complete beginner like me. what I'm missing is a coyote-timer, because right now you can always jump after falling from a plattform (mid-air). how would I set something like that up? do I need to set up a new state like "falling"? the walljumping doesn't quite feel right, because you have to press into the wall (left/right) and then jump to activate the walljump. simply touching the wall doesn't do it or pressing slightly too early into the other direction. how could I improve that? with a raycast? thanks for everything!
Thanks for checking out. I found a way to make easier version of this code and I am working on a improved version (especially on wall jumps) I'll let you know when I upload it.
For coyote time, people generally uses a variable to jump control and changes it after a time (like 0.1 seconds) you can use timer nodes or you can use something like:
jump_variable=true
yield(get_tree().create_timer(0.1),"timeout")
jump_variable=false
I am still not sure how to make wall jumps better but right now I am working with timers (kinda like to early_jump codes in this version) to make wall jumps feel smoother
Let me know if there are more things that I can add in next version that you think will make controls better.
Hi, I added a new version with coyote jump and with some improvements. Still struggling with wall jumps but you can see the codes of improvements on there too. If you want, you can play the new demo on itch page without downloading
Hope it helps
Thanks for the update! I improved my playerscript over the last weeks myself and what helped me for good walljumping are raycasts that detect the walls and the correct direction plus the coyote timer is working on them too, so if you'd pressed slightly to early in one direction, the jump will still be possible.
I am not good with raycast so I made them with timers (especially yield code) In v3, if you press jump direction when you are on wall, it doesn't move you for a little time and you can still wall jump. it gave the character (or box, I guess) a sticky feeling like super meat boy. HTML version is updated too, you can try it if you want