i’m making my first ever game and I’m trying to stop my character from moving in the air. I want the character to keep the velocity of the jump too. I’ve tried using
if not is_on_floor(): velocity.x = 0 velocity.z = 0
but it had no effect.
I would take your movement code, and only change velocity when they are on the floor. Something like this?
if is_on_floor(): if Input.is_action_pressed("move_right"): velocity.x = SPEED elif Input.is_action_pressed("move_left"): velocity.x = -SPEED if Input.is_action_pressed("jump"): velocity.y = JUMP_VELOCITY
that’s actually a very simple solution how did i not think of that!? thank you very much :3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.