extends Node2D

export var loot:PackedScene = null
var _breakable = true


func take_damage():
  if not _breakable: return
  _breakable = false
  AudioManager.play_sfx(AudioManager.Sfx.VASE_BREAK)
  $AnimationPlayer.play("break")
  yield(get_tree().create_timer(.2), "timeout")
  if loot != null:
    var scene = loot.instance()
    scene.position = position + Vector2(0, -8)
    get_parent().add_child(scene)