How to I play an animation player on contact with enemy?

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

When the player dies, a colorRect appears that says game over, or that’s what’s supposed to happen but nothing does. I touch the enemy and it doesn’t happen.

func _on_enemy_area_entered(area):
dead = true
if dead:
	get_node("GAME OVER").play("._game_over_.")
	yield(get_node("GAME OVER"), "animation_finished")

Are you getting any errors or warnings? Have you made sure the callback is properly connected (print something or place a breakpoint at the beginning of the function)?

njamster | 2020-09-02 12:01

I think it could possibly be because the enemy moves via an animation player node | 2020-09-12 18:06