.
This commit is contained in:
parent
961f93a4f4
commit
6041004af8
1 changed files with 14 additions and 6 deletions
20
troup.gd
20
troup.gd
|
|
@ -16,10 +16,18 @@ func _get_target(event) -> void:
|
||||||
#self.position = self.position.move_toward(target.transform.position, speed * delta)
|
#self.position = self.position.move_toward(target.transform.position, speed * delta)
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
#if target != null:
|
||||||
var num = abs(abs(self.global_position) - abs(target.global_position))
|
print(self.global_position.distance_to(target.global_position))
|
||||||
|
var num = abs(abs(self.global_position) - abs(target.global_position))
|
||||||
#print(num)
|
#print(num)
|
||||||
if (num > Vector2(2,2)):
|
var direction = (target.global_position - self.global_position).normalized() * SPEED * delta
|
||||||
self.position = self.position.move_toward(target.position, SPEED * delta)
|
#if (num > Vector2(2,2)):
|
||||||
|
if (self.global_position.distance_to(target.global_position) > 0.2):
|
||||||
move_and_slide()
|
self.velocity = direction
|
||||||
|
#self.global_position = self.global_position.move_toward(target.global_position, SPEED * delta)
|
||||||
|
elif (target.is_class("SentientCurrency")):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
#target = null
|
||||||
|
move_and_slide()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue