godot-steering-ai-framework/project/demos/PursueSeek/BoundaryManager.gd
Francois Belair 6e6f27505c Fix init time setters and export Follow variables
The use of `not is_inside_tree()` before setting the setting class' value
meant that the starting values would always be the default. Moving the
value setting before checking for tree readiness fixes the issue.
2020-01-16 12:31:02 -05:00

18 lines
381 B
GDScript

extends Node2D
# Wraps the ships' positions around the world border.
var _world_bounds: Vector2
func _ready() -> void:
_world_bounds = Vector2(
ProjectSettings["display/window/size/width"],
ProjectSettings["display/window/size/height"]
)
func _physics_process(delta: float) -> void:
for ship in get_children():
ship.position = ship.position.posmodv(_world_bounds)