seperate ui controls from gameplay controls, scrolling controls screen

This commit is contained in:
Haze Weathers 2024-04-01 14:12:32 -04:00
parent 3c69e4d14d
commit ab094fd6ce
8 changed files with 273 additions and 71 deletions

View file

@ -2,14 +2,19 @@ extends Node
const CFG_PATH := "user://controls.pr"
const ACTIONS := ["move_left", "move_right", "move_up", "move_down", "jump", "shoot"]
const ACTIONS := [
"move_left", "move_right",
"move_up", "move_down",
"jump", "shoot",
"ui_accept", "ui_cancel",
]
const LINKED_ACTIONS := {
move_left = "ui_left",
move_right = "ui_right",
move_up = "ui_up",
move_down = "ui_down",
jump = "ui_accept",
shoot = "ui_cancel",
# jump = "ui_accept",
# shoot = "ui_cancel",
}
@ -47,6 +52,14 @@ func set_button(action: String, button_index: int) -> void:
_save_bindings()
func default_controls() -> void:
for action in ACTIONS:
set_key(action, _get_default_key(action))
set_button(action, _get_default_button(action))
for button in get_tree().get_nodes_in_group("controls_buttons"):
button._update_text()
func _save_bindings() -> void:
cfg.save(CFG_PATH)