opponent.gd 297 B

123456789101112131415161718
  1. extends Combatant
  2. func set_active(value):
  3. super.set_active(value)
  4. if not active:
  5. return
  6. if not $Timer.is_inside_tree():
  7. return
  8. $Timer.start()
  9. await $Timer.timeout
  10. var target
  11. for actor in get_parent().get_children():
  12. if not actor == self:
  13. target = actor
  14. break
  15. attack(target)