extends CharacterBody2D func _ready(): add_to_group("enemies") get_node("Collision").init() get_node("Movement").connect("direction_changed", func(current_direction): var frame = $AnimatedSprite2D.frame var progress = $AnimatedSprite2D.frame_progress if current_direction == Vector2.UP: $AnimatedSprite2D.play("up") elif current_direction == Vector2.DOWN: $AnimatedSprite2D.play("down") elif current_direction == Vector2.LEFT: $AnimatedSprite2D.play("left") elif current_direction == Vector2.RIGHT: $AnimatedSprite2D.play("right") $AnimatedSprite2D.set_frame_and_progress(frame, progress) ) func _physics_process(delta): get_node("Movement").physics_process(delta) # todo: animation shadow