tool
extends StaticBody2D

export var left_monster_path : NodePath setget set_left_monster

export var right_monster_path : NodePath setget set_right_monster

export var count : int = 0

func _ready():
	var left_monster = get_node(left_monster_path)
	var right_monster = get_node(right_monster_path)
	left_monster.get_child(0).connect("monster_dead",self,"on_monster_dead")
	right_monster.get_child(0).connect("monster_dead",self,"on_monster_dead")

func set_left_monster(value):
	print(value)
	left_monster_path = value
	count += 1

func set_right_monster(value):
	right_monster_path = value
	count += 1

func on_monster_dead():
	count -= 1
	if count == 0:
		$AnimatedSprite.playing = true

func _on_AnimatedSprite_animation_finished():
	queue_free()
