extends AbstractPrey2D @onready var sprite = get_node("AnimatedSprite2D") # Called when the node enters the scene tree for the first time. func _ready() -> void: $AnimatedSprite2D.animation = "Healthy" $AnimatedSprite2D.play() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: return func _physics_process(delta: float) -> void: self.move(Vector3(randfn(0, 1), randfn(0, 1), 0)) func move(destination: Vector3) -> void: move_and_collide(Vector2(destination.x, destination.y)) func die() -> void: sprite.play("Dying") super.die() func _on_area_2d_body_entered(body: Node2D) -> void: # TODO: collision with other entities # check if colision with player if body.is_in_group("player"): handle_collision_player(body) # Function to handle collision logic func handle_collision_player(player): self.health -= player.damage if sprite: if self.health <= 0: self.die() else: sprite.play("Injured")