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!
Viewing post in 2D Platformer Controls in Godot Engine comments
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.
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