ft: prey sprite update

This commit is contained in:
2026-01-29 10:31:24 +01:00
parent 7207626315
commit 69776a6973
10 changed files with 34 additions and 22 deletions

View File

@@ -26,14 +26,15 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
func _process(delta: float) -> void:
# smoothly rotate
if self.rotation != self.desired_rotation: # FIXME: causes the mirror sprites to flip out
self.rotation = lerp_angle(self.rotation, self.desired_rotation, clampf(4 * delta, 0, 1))
# Boundary mirroring
_handle_wrapping()
func _physics_process(delta: float) -> void:
# rotate smoothly
if self.rotation != self.desired_rotation: # FIXME: causes the mirror sprites to flip out
self.rotation = lerp_angle(self.rotation, self.desired_rotation, 4 * delta)
pass
func move(motion: Vector3) -> void:
move_and_collide(Vector2(motion.x, motion.y)) # Moves along the given vector
@@ -61,7 +62,7 @@ func become_injured() -> void:
mirrorSprite3.play("Injured")
func _on_sight_body_entered(body: Node2D) -> void:
if body.is_in_group("predators") or body.is_in_group("player"):
if body.is_in_group("predators") or (body.is_in_group("player") and health < maxHealth):
fsm.transition_to_next_state(fsm.States.FLEEING, {"threat": body})