refactor: remove print_debug and switch to preload for movement scripts
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user