y velocity set to zero when hitting ceiling

This commit is contained in:
pennyrigate 2022-12-25 18:39:44 -05:00
parent 44fe829344
commit 48cc1d43d6

View file

@ -64,6 +64,11 @@ func _physics_process(delta):
#Gravity
if current_state != State.CLIMB: velocity.y += gravity
#Cut y velocity when hitting ceiling
if is_on_ceiling():
current_state = State.FALL
position.y += 1
velocity.y = 0
#Apply velocity
move_and_slide(velocity,Vector2.UP)
#Debug