godot-steering-ai-framework/project/demos/pursue_vs_seek/PursueVSSeekDemo.gd
Francois Belair 9f945cbf85 Implement review suggestions to code
Razvan reviewed the code and suggested a number of changes to improve
readability and make facets of the code more explicit and consistent.
2020-01-12 10:20:06 -05:00

24 lines
753 B
GDScript

extends Node2D
onready var gui: = $GUI
onready var pursuer: = $BoundaryManager/Pursuer
onready var seeker: = $BoundaryManager/Seeker
func _ready() -> void:
gui.linear_speed.text = str(pursuer.agent.max_linear_speed)
gui.linear_accel.text = str(pursuer.agent.max_linear_acceleration)
gui.connect("linear_accel_changed", self, "_on_GUI_linear_accel_changed")
gui.connect("linear_speed_changed", self, "_on_GUI_linear_speed_changed")
func _on_GUI_linear_accel_changed(value: int) -> void:
pursuer.agent.max_linear_acceleration = float(value)
seeker.agent.max_linear_acceleration = float(value)
func _on_GUI_linear_speed_changed(value: int) -> void:
pursuer.agent.max_linear_speed = float(value)
seeker.agent.max_linear_speed = float(value)