mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 23:54:23 +00:00
Make sure MoveTowards
doesn't overshoot its target
This commit is contained in:
parent
70bc60a8e8
commit
e54831e616
1 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@ func _physics_process(delta: float) -> void:
|
|||
if enabled:
|
||||
if target:
|
||||
var gap = target.global_position - global_position
|
||||
var norm = gap.normalized()
|
||||
move.emit(norm * delta * speed)
|
||||
var norm = Vector2.ZERO.move_toward(gap, delta * speed)
|
||||
move.emit(norm)
|
||||
else:
|
||||
move.emit(Vector2.ZERO)
|
||||
|
|
Loading…
Reference in a new issue