feat: implement pause menu with loadout management and rebindable input settings

This commit is contained in:
DottsGit
2026-06-04 11:33:10 -04:00
parent 8c928c2d92
commit 02c6caa0d6
5 changed files with 259 additions and 47 deletions
+11 -40
View File
@@ -11,11 +11,19 @@ var _player: CharacterBody3D
func _ready() -> void:
build()
# Hide mouse
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
_build_materials()
_build_geometry()
_build_hud()
func build() -> void:
_build_input_map()
func _build_materials() -> void:
pass
func _build_geometry() -> void:
_build_environment()
_build_floor()
_build_walls_arena()
@@ -25,7 +33,6 @@ func build() -> void:
_build_speed_corridor()
_build_lighting()
_build_player()
_build_hud()
# ── Utility ───────────────────────────────────────────────────────────────────
@@ -56,42 +63,6 @@ func _ramp_static(pos: Vector3, size: Vector3, rot_deg: Vector3, color: Color, n
return body
# ── Input Map ─────────────────────────────────────────────────────────────────
func _build_input_map() -> void:
var bindings := {
"jump": [KEY_SPACE],
"crouch": [KEY_CTRL],
"dash": [KEY_SHIFT],
"fire": [MOUSE_BUTTON_LEFT],
"fire_alt": [MOUSE_BUTTON_RIGHT],
"reload": [KEY_R],
"interact": [KEY_E],
"move_forward": [KEY_W],
"move_back": [KEY_S],
"move_left": [KEY_A],
"move_right": [KEY_D],
"weapon_next": [MOUSE_BUTTON_WHEEL_UP],
"weapon_prev": [MOUSE_BUTTON_WHEEL_DOWN],
"weapon_1": [KEY_1],
"weapon_2": [KEY_2],
"weapon_3": [KEY_3],
}
for action in bindings:
if not InputMap.has_action(action):
InputMap.add_action(action)
InputMap.action_erase_events(action)
for code in bindings[action]:
if code in [KEY_SPACE, KEY_SHIFT, KEY_CTRL, KEY_R, KEY_F, KEY_E, KEY_W, KEY_S, KEY_A, KEY_D, KEY_1, KEY_2, KEY_3]:
var ev := InputEventKey.new()
ev.keycode = code
InputMap.action_add_event(action, ev)
else:
var ev := InputEventMouseButton.new()
ev.button_index = code
InputMap.action_add_event(action, ev)
# ── Environment ───────────────────────────────────────────────────────────────
func _build_environment() -> void: