What I want to achieve is, when the player jumps I want to change its horizontal move_speed, and when the player hits the ground, the horizontal speed will be changed back to a default value.
The question is that, when I do this:
velocity.y = -100
print("JUMP")
move_and_slide()
if is_on_floor():
print("Hit the ground!!")
The output is always like this:
JUMP
Hit the ground!!!
The problem is the moment when a character takes off, the output if ‘is_on_floor’ is still true.
Thus, my horizontal speed will be changed back to default values immediately…
Thanks for reading my question, I’ll be extremely appreciated if you can help me.
Thanks for your help, I changed my code according to your suggestion, and it now works fine in my project. I really appreciated! Hope you have a nice day!!