forked from team-sg/hero-mark-2
y velocity set to zero when hitting ceiling
This commit is contained in:
parent
44fe829344
commit
48cc1d43d6
1 changed files with 5 additions and 0 deletions
|
@ -64,6 +64,11 @@ func _physics_process(delta):
|
||||||
|
|
||||||
#Gravity
|
#Gravity
|
||||||
if current_state != State.CLIMB: velocity.y += 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
|
#Apply velocity
|
||||||
move_and_slide(velocity,Vector2.UP)
|
move_and_slide(velocity,Vector2.UP)
|
||||||
#Debug
|
#Debug
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue