## InputHandler — maps Godot Input Actions to FPS character controls. ## ## This script is NOT required at runtime — it exists to document the input ## map bindings that FPSCharacterController expects. Add these actions to ## your Project → Input Map (or load this script as an autoload for reference). ## ## Bindings (tactical FPS layout): ## ## Action Key Description ## ─────────────────────────────────────────────────────── ## move_forward W Walk forward ## move_backward S Walk backward ## move_left A Strafe left ## move_right D Strafe right ## jump Space Jump ## sprint Shift Sprint / walk-toggle ## crouch Ctrl Crouch (hold or toggle) ## shoot Mouse LMB Fire weapon ## aim Mouse RMB Aim down sights ## reload R Reload weapon ## interact E Use/interact ## toggle_walk_toggle (not bound) Toggle walk-toggle mode ## toggle_crouch_toggle (not bound) Toggle crouch-toggle mode ## ui_cancel Esc Release mouse capture ## ## Implementation note: ## FPSCharacterController reads input directly via Input.is_action_pressed() ## in _physics_process. No separate InputHandler node is needed unless you ## want to add rebinding, analog input smoothing, or input buffering. extends Node func _ready() -> void: # This script documents bindings only — no runtime logic. # To enforce default bindings at startup, uncomment the next lines: # _ensure_action(&"move_forward", KEY_W) # _ensure_action(&"move_backward", KEY_S) # _ensure_action(&"move_left", KEY_A) # _ensure_action(&"move_right", KEY_D) # _ensure_action(&"jump", KEY_SPACE) # _ensure_action(&"sprint", KEY_SHIFT) # _ensure_action(&"crouch", KEY_CTRL) # _ensure_action(&"shoot", MOUSE_BUTTON_LEFT) # _ensure_action(&"aim", MOUSE_BUTTON_RIGHT) # _ensure_action(&"reload", KEY_R) # _ensure_action(&"interact", KEY_E) pass ## Ensure an input action exists with the given default key binding. ## Only sets the binding if the action does not already exist. func _ensure_action(action_name: StringName, key: Key) -> void: if InputMap.has_action(action_name): return var ev := InputEventKey.new() ev.keycode = key InputMap.add_action(action_name) InputMap.action_add_event(action_name, ev)