forked from team-sg/hero-mark-2
seperate ui controls from gameplay controls, scrolling controls screen
This commit is contained in:
parent
3c69e4d14d
commit
ab094fd6ce
8 changed files with 273 additions and 71 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue