godot-steering-ai-framework/project/demos/seek_and_flee/GUI.gd
Francois Belair 3d50dcdb9c Add GUI controls to seek/flee demo
Being toy demos, they should be easily tweakable and modifiable by the
user to get a feel for what the parameters of the behaviors do.
2020-01-12 10:18:53 -05:00

29 lines
655 B
GDScript

extends MarginContainer
enum BehaviorMode { SEEK, FLEE }
signal mode_changed(behavior_mode)
onready var seek: CheckBox = $BehaviorControls/Seek
onready var flee: CheckBox = $BehaviorControls/Flee
func _ready() -> void:
seek.connect("pressed", self, "_on_Seek_pressed")
flee.connect("pressed", self, "_on_Flee_pressed")
func _on_Seek_pressed() -> void:
flee.pressed = false
flee.button_mask = BUTTON_MASK_LEFT
seek.button_mask = 0
emit_signal("mode_changed", BehaviorMode.SEEK)
func _on_Flee_pressed() -> void:
seek.pressed = false
seek.button_mask = BUTTON_MASK_LEFT
flee.button_mask = 0
emit_signal("mode_changed", BehaviorMode.FLEE)