fx: adjusted prey speed
This commit is contained in:
parent
07f3c13fd2
commit
b56d0cb777
|
|
@ -3,6 +3,7 @@ extends AbstractPrey2D
|
||||||
@onready var sprite = get_node("AnimatedSprite2D")
|
@onready var sprite = get_node("AnimatedSprite2D")
|
||||||
@onready var fsm = $StateMachine
|
@onready var fsm = $StateMachine
|
||||||
|
|
||||||
|
@export var speed = 0.5
|
||||||
var desired_rotation: float = self.rotation
|
var desired_rotation: float = self.rotation
|
||||||
|
|
||||||
# Mirrored sprites for periodic boundary
|
# Mirrored sprites for periodic boundary
|
||||||
|
|
@ -38,7 +39,7 @@ func _physics_process(delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func move(motion: Vector3) -> void:
|
func move(motion: Vector3) -> void:
|
||||||
move_and_collide(Vector2(motion.x, motion.y)) # Moves along the given vector
|
move_and_collide(Vector2(motion.x, motion.y).normalized() * self.speed) # Moves along the given vector
|
||||||
self.desired_rotation = atan2(motion.y, motion.x)
|
self.desired_rotation = atan2(motion.y, motion.x)
|
||||||
|
|
||||||
# Apply boundary to new position
|
# Apply boundary to new position
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ animations = [{
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
motion_mode = 1
|
motion_mode = 1
|
||||||
script = ExtResource("2_0227s")
|
script = ExtResource("2_0227s")
|
||||||
|
speed = 0.5
|
||||||
maxHealth = 20
|
maxHealth = 20
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=788182944]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=788182944]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue