My player doesnt falls when he dies

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By malaka

var motion = Vector2()
var GR = 15

func OnDeath():
$CollisionShape2D.call_deferred(“set_disabled”, true)

func _physics_process(delta):
motion.y += GR
motion.x = motion.x
motion.y = move_and_slide(motion, UP , true).y

does OnDeath even gets called?

klaas | 2020-08-26 07:40

of course
func OnHit(damage): current_hp -= damage if current_hp <= 0: is_dead = true OnDeath()

malaka | 2020-08-26 07:55

Well … i would set a breakpoint in the OnDeath function and carefully “step into” while observing the $sprite. This should shed some light on this issue.

klaas | 2020-08-26 10:09