ft: prey sprite update
This commit is contained in:
@@ -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})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user