godot-third-person-basic-scene/scenes/controls/control_function.gd

26 lines
459 B
GDScript

extends HBoxContainer
signal add_pressed( command )
var action = null
func set_label( command ):
$Label.text = command
func set_action( _action ):
action = _action
func set_param(_action, _command, position):
set_label(_command)
set_action(_action)
if position:
$Add_front.visible = true
$Add.visible = false
else:
$Add_front.visible = false
$Add.visible = true
func _on_add_pressed():
emit_signal( "add_pressed", action, $Label.text )