Menu, options with changeable controls, fade transition, placeholder background
This commit is contained in:
@@ -12,7 +12,7 @@ const _ABILITY_ICONS: Array[String] = [
|
||||
"res://HUD/HUD_0001_ability_SLAM.png",
|
||||
"res://HUD/HUD_0002_ability_DASH.png",
|
||||
]
|
||||
const _ABILITY_KEYS: Array[String] = ["F", "G", "H"]
|
||||
const _ABILITY_ACTIONS: Array[StringName] = [&"ability_kick", &"ability_slam", &"ability_dash"]
|
||||
|
||||
var _controls_visible: bool = true
|
||||
var _controls_panel: PanelContainer
|
||||
@@ -68,6 +68,14 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if event.physical_keycode == KEY_TAB:
|
||||
_toggle_controls()
|
||||
elif event.physical_keycode == KEY_ESCAPE:
|
||||
_return_to_menu()
|
||||
|
||||
|
||||
func _return_to_menu() -> void:
|
||||
get_tree().paused = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
get_tree().change_scene_to_file("res://MainMenu.tscn")
|
||||
|
||||
|
||||
func _toggle_controls() -> void:
|
||||
@@ -208,7 +216,7 @@ func _build_ability_slot(idx: int) -> Control:
|
||||
_cd_labels.append(cd_lbl)
|
||||
|
||||
var key_lbl := Label.new()
|
||||
key_lbl.text = _ABILITY_KEYS[idx]
|
||||
key_lbl.text = Controls.get_key_label(_ABILITY_ACTIONS[idx])
|
||||
key_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
key_lbl.add_theme_color_override("font_color", _GOLD)
|
||||
key_lbl.add_theme_font_size_override("font_size", 12)
|
||||
@@ -250,15 +258,23 @@ func _build_controls_panel() -> void:
|
||||
vbox.add_theme_constant_override("separation", 5)
|
||||
_controls_panel.add_child(vbox)
|
||||
|
||||
_row(vbox, "WASD / Arrows", "Move (not intended)", _MUTED)
|
||||
var move_keys := "%s %s %s %s" % [
|
||||
Controls.get_key_label(&"move_forward"),
|
||||
Controls.get_key_label(&"move_left"),
|
||||
Controls.get_key_label(&"move_back"),
|
||||
Controls.get_key_label(&"move_right"),
|
||||
]
|
||||
_row(vbox, move_keys, "Move (not intended)", _MUTED)
|
||||
_row(vbox, "LMB (hold)", "Right horn", _CREAM)
|
||||
_row(vbox, "RMB (hold)", "Left horn", _CREAM)
|
||||
_row(vbox, "F", "Kick", _CREAM)
|
||||
_row(vbox, "G", "Slam", _CREAM)
|
||||
_row(vbox, "H", "Dash", _CREAM)
|
||||
_row(vbox, Controls.get_key_label(&"charge"), "Charge", _CREAM)
|
||||
_row(vbox, Controls.get_key_label(&"ability_kick"), "Kick", _CREAM)
|
||||
_row(vbox, Controls.get_key_label(&"ability_slam"), "Slam", _CREAM)
|
||||
_row(vbox, Controls.get_key_label(&"ability_dash"), "Dash", _CREAM)
|
||||
_row(vbox, "Scroll", "Zoom", _CREAM)
|
||||
_row(vbox, "R", "Respawn matadors (cooldown)", _MUTED)
|
||||
_row(vbox, "Tab", "Toggle controls", _MUTED)
|
||||
_row(vbox, "Esc", "Back to menu", _MUTED)
|
||||
|
||||
var sep := HSeparator.new()
|
||||
var sep_style := StyleBoxFlat.new()
|
||||
|
||||
Reference in New Issue
Block a user