1234567891011121314151617181920212223242526272829303132333435 |
- extends Control
- @onready var commands_list = $ScrollContainer/VBoxContainer
- const packed_command_node = preload("res://scenes/hud/command_node/command_node.tscn")
- signal run_commands(list)
- func _on_move_pressed() -> void:
- var command_node = packed_command_node.instantiate()
- command_node.set_command_texture(BaseLevel.Commands.MOVE)
- commands_list.add_child(command_node)
- func _on_rotate_left_pressed() -> void:
- var command_node = packed_command_node.instantiate()
- command_node.set_command_texture(BaseLevel.Commands.ROTATE_LEFT)
- commands_list.add_child(command_node)
- func _on_rotate_right_pressed() -> void:
- var command_node = packed_command_node.instantiate()
- command_node.set_command_texture(BaseLevel.Commands.ROTATE_RIGHT)
- commands_list.add_child(command_node)
- func _on_cancel_pressed() -> void:
- var count := commands_list.get_child_count()
- if count == 0:
- return
- commands_list.get_children()[count - 1].queue_free()
- func _on_run_pressed() -> void:
- run_commands.emit(commands_list.get_children())
|