2024-02-22 06:22:22 +11:00
|
|
|
class_name BeeliningController extends EnemyMovement
|
2023-11-11 19:03:01 +11:00
|
|
|
|
2024-02-22 06:22:22 +11:00
|
|
|
var goal: Node3D
|
|
|
|
var direction: Vector3
|
2023-11-11 19:03:01 +11:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
distance_remaining = character.global_position.distance_squared_to(goal.global_position)
|
|
|
|
direction = character.global_position.direction_to(goal.global_position)
|
|
|
|
|
|
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
2024-02-22 06:22:22 +11:00
|
|
|
var distance_travelled: float = (character.stats.movement_speed * clampf(character.movement_speed_penalty, 0.0, 1.0)) * delta
|
2023-11-11 19:03:01 +11:00
|
|
|
distance_remaining -= distance_travelled
|
|
|
|
character.global_position = character.global_position + (direction * distance_travelled)
|