ft (wip): tracking across boundaries

This commit is contained in:
djaidjai committed 2026-02-07 18:13:32 +01:00
1 parent 0f06846157
commit bc582efb90
12 files changed
+93 -43

No files matched your search

@@ -11,12 +11,12 @@ func enter(previous_state_path: String, data := {}) -> void:
finished.emit(owner.fsm.States.IDLE, {})
func physics_update(_delta: float) -> void:
if target == owner or target == null or owner.position.distance_to(target.position) > owner.sight_range:
if target == null or GameManager.calc_distance(owner.position, target.position) > owner.sight_range:
finished.emit(owner.fsm.States.IDLE, {})
return
# alternatively, we could use a collision shape and inbuilt signals, but im not sure if that works better (mixing signals and custom fsm stuff i mean
if owner.position.distance_to(target.position) > owner.attack_range:
if GameManager.calc_distance(owner.position, target.position) > owner.attack_range:
owner.move(move_towards(target.position))
else:
owner.attack(target)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.