This repository has been archived on 2025-09-12. You can view files and clone it, but cannot push or open issues or pull requests.
ld48/character/EnemyController.gd
2021-04-25 16:34:08 -04:00

18 lines
452 B
GDScript

extends Area2D
func _ready():
connect("body_entered", self, "on_body_entered")
connect("body_exited", self, "on_body_exited")
func on_body_entered(body):
if body.name == "PlayerCharacter":
for child in get_children():
if child.has_method("set_target"):
child.set_target(body)
func on_body_exited(body):
if body.name == "PlayerCharacter":
for child in get_children():
if child.has_method("set_target"):
child.set_target(null)