For my future self:
The Cyan gets destroyed:
extends Area2D
var kill = false
onready var anim = $AnimationPlayer
var cur_anim = ""
func _ready():
change_anim("idle")
func change_anim(new_anim):
if cur_anim != new_anim:
anim.play(new_anim)
cur_anim = new_anim
func break_animation_finished():
queue_free()
func _process(delta):
if Input.is_action_just_pressed("ui_accept") && kill:
change_anim("break")
func _on_Blue_body_entered(body):
if body.name == "Player":
kill = true