Feat/1 movement foundation #5

Merged
Dotts merged 40 commits from feat/1-movement-foundation into main 2026-06-03 21:34:25 -07:00
2 changed files with 12 additions and 9 deletions
Showing only changes of commit 693145fd69 - Show all commits
+2 -3
View File
@@ -65,8 +65,7 @@ func _build_player() -> void:
shape.shape.height = 1.8
player.add_child(shape)
# Movement controller MUST be attached first, before machine/children
var mover_script = load("res://movement/player_movement_controller.gd")
var mover_script = preload("res://movement/player_movement_controller.gd")
if mover_script:
player.set_script(mover_script)
@@ -75,7 +74,7 @@ func _build_player() -> void:
sm.name = "MovementStateMachine"
player.add_child(sm)
var sm_script = load("res://movement/movement_state_machine.gd")
var sm_script = preload("res://movement/movement_state_machine.gd")
if sm_script:
sm.set_script(sm_script)
+10 -6
View File
@@ -13,6 +13,7 @@ signal chain_updated(count: int, bonus: float)
var machine: MovementStateMachine
var jump_buffered: bool = false
var _ready_ran: bool = false
var _machine: MovementStateMachine = null
# ── Helpers ───────────────────────────────────────────────────────────────────
func _ensure_machine() -> MovementStateMachine:
@@ -33,13 +34,16 @@ func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_accept"):
# Space / jump
pass
_machine.input_jump_just_pressed = Input.is_action_just_pressed("jump")
_machine.input_jump_pressed = Input.is_action_pressed("jump")
_machine.input_sprint = Input.is_action_pressed("sprint")
_machine.input_crouch = Input.is_action_pressed("crouch")
_machine.input_dash = Input.is_action_just_pressed("dash")
var node := _ensure_machine()
if not node:
return
node.input_jump_just_pressed = Input.is_action_just_pressed("jump")
node.input_jump_pressed = Input.is_action_pressed("jump")
node.input_sprint = Input.is_action_pressed("sprint")
node.input_crouch = Input.is_action_pressed("crouch")
node.input_dash = Input.is_action_just_pressed("dash")
var input_v := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
_machine.input_dir = input_v
node.input_dir = input_v
@onready var _machine = get_node("MovementStateMachine")