help with jump mechanics

Godot Version

godot 4

Question

hey guys im quite new to godot and im just testing out things to learn. i recently got my character to walk and jump. however i am so used to playing games like maplestory and being able to move my jump feels weird to me.

i’d like to create a jump mechanic that is not movable but will rather move my character forward automatically as a reaction to the speed from the walk. if that makes sense. just seems more realistic to me.

ive been trying to find youtube tutorials and posts on this. but it doesnt seem like a popular topic.

is there anyone who could help me achieve such jump mechanic? thanks :slightly_smiling_face:

picture of my current code, let me know if there are any improvements that i could make :):

What do you mean by “being able to move my jump”? Do you want to restrict the player’s left and right movement while the player is jumping? I think what you’re aiming for is to keep the speed that the player is moving at constant between the start and end of the jump.

So change your code so that the x velocity and direction does not change while the player has just jumped and is off the floor.