Feat/1 movement foundation #5
@@ -7,6 +7,11 @@ signal chain_updated(count: int, bonus: float)
|
|||||||
|
|
||||||
var _machine: MovementStateMachine = null
|
var _machine: MovementStateMachine = null
|
||||||
|
|
||||||
|
# Explicitly ensure this node ticks after being attached by set_script().
|
||||||
|
func _ensure_process() -> void:
|
||||||
|
set_process(true)
|
||||||
|
set_physics_process(true)
|
||||||
|
|
||||||
|
|
||||||
func _ensure_machine() -> MovementStateMachine:
|
func _ensure_machine() -> MovementStateMachine:
|
||||||
if is_instance_valid(_machine):
|
if is_instance_valid(_machine):
|
||||||
@@ -38,6 +43,7 @@ func _ready() -> void:
|
|||||||
sm.player = self
|
sm.player = self
|
||||||
sm.params = params
|
sm.params = params
|
||||||
sm.movement_event.connect(_on_movement_event)
|
sm.movement_event.connect(_on_movement_event)
|
||||||
|
_ensure_process()
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
@@ -51,7 +57,7 @@ func _process(_delta: float) -> void:
|
|||||||
sm.input_dash = Input.is_action_just_pressed("dash") and not sm.input_dash
|
sm.input_dash = Input.is_action_just_pressed("dash") and not sm.input_dash
|
||||||
sm.input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
sm.input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||||
|
|
||||||
# DEBUG: confirm controller is receiving input and machine state each frame
|
# DEBUG: emit every frame so we can see whether inputs reach the controller.
|
||||||
var p = sm.player
|
var p = sm.player
|
||||||
print("MOVEMENT_DEBUG state=%s vel=%s input_dir=%s jump=%s sprint=%s crouch=%s dash=%s" % [
|
print("MOVEMENT_DEBUG state=%s vel=%s input_dir=%s jump=%s sprint=%s crouch=%s dash=%s" % [
|
||||||
sm.current_state,
|
sm.current_state,
|
||||||
|
|||||||
Reference in New Issue
Block a user