wall run, keyboard controls, mouse sensitivity setting, and more
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 19s
Create tag and build when new code gets to main / Export (push) Successful in 6m15s

This commit is contained in:
2025-11-13 22:38:44 +01:00
parent 27130257c9
commit ac14352e7f
13 changed files with 499 additions and 87 deletions

View File

@@ -6,6 +6,10 @@ class_name InputController
@export_group("Move actions")
@export var move:GUIDEAction
@export var move_left:GUIDEAction
@export var move_right:GUIDEAction
@export var move_front:GUIDEAction
@export var move_back:GUIDEAction
@export var rotate_y:GUIDEAction
@export var rotate_floorplane:GUIDEAction
@@ -25,9 +29,13 @@ class_name InputController
@export var dash:GUIDEAction
@export var throw:GUIDEAction
signal input_device_changed(is_gamepad: bool)
var _using_gamepad = false
signal input_move(value: Vector3)
signal input_rotate_y(value: float)
signal input_rotate_floorplane(value: float)
signal input_move_keyboard(value: Vector3)
# Jump
signal input_jump_started
@@ -100,7 +108,27 @@ func on_input_empower_released():
func on_input_aim_canceled():
input_aim_canceled.emit()
func _input(event: InputEvent) -> void:
if event is InputEventKey:
if _using_gamepad:
_using_gamepad = false
input_device_changed.emit(_using_gamepad)
elif event is InputEventJoypadMotion:
if !_using_gamepad:
if abs(event.axis_value) > 0.5:
_using_gamepad = true
input_device_changed.emit(_using_gamepad)
elif event is InputEventJoypadButton:
if !_using_gamepad:
_using_gamepad = true
input_device_changed.emit(_using_gamepad)
func _process(_delta: float) -> void:
var value_horizontal = -move_left.value_axis_1d + move_right.value_axis_1d
var value_vertical = -move_front.value_axis_1d + move_back.value_axis_1d
var keyboard_input_vector = Vector3(value_horizontal, 0, value_vertical)
input_move_keyboard.emit(keyboard_input_vector)
input_move.emit(move.value_axis_3d)
input_rotate_y.emit(rotate_y.value_axis_1d)
input_rotate_floorplane.emit(rotate_floorplane.value_axis_1d)