ft (wip): tracking across boundaries
This commit is contained in:
@@ -58,9 +58,10 @@ script = ExtResource("2_0227s")
|
||||
speed = 0.5
|
||||
maxHealth = 20
|
||||
|
||||
[node name="WrappingManager" type="Node" parent="." index="0" unique_id=407460873 node_paths=PackedStringArray("sprite")]
|
||||
[node name="WrappingManager" type="Node" parent="." index="0" unique_id=407460873 node_paths=PackedStringArray("sprite", "shape")]
|
||||
script = ExtResource("3_lecx4")
|
||||
sprite = NodePath("../AnimatedSprite2D")
|
||||
shape = NodePath("../CollisionPolygon2D")
|
||||
metadata/_custom_type_script = "uid://bvbc0n0pslq7p"
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="1" unique_id=788182944]
|
||||
|
||||
@@ -11,7 +11,7 @@ func enter(previous_state_path: String, data := {}) -> void:
|
||||
finished.emit(owner.fsm.States.IDLE, {})
|
||||
|
||||
func physics_update(_delta: float) -> void:
|
||||
if owner.position.distance_to(threat.position) > threshold or threat == owner:
|
||||
if GameManager.calc_distance(owner.position, threat.position) > threshold:
|
||||
finished.emit(owner.fsm.States.IDLE, {})
|
||||
return
|
||||
owner.move(flee_from(threat.position))
|
||||
|
||||
Reference in New Issue
Block a user