Feat/14 movement overhaul #20
@@ -72,13 +72,17 @@ func _process(delta: float) -> void:
|
|||||||
if not animation_player:
|
if not animation_player:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Poll the movement state machine for current state
|
# Get movement state from the state machine
|
||||||
var sm = get_parent().get_node_or_null("MovementStateMachine")
|
var sm = get_parent().get_node_or_null("MovementStateMachine")
|
||||||
if not sm:
|
if not sm:
|
||||||
return
|
return
|
||||||
|
|
||||||
var state = sm.current_state
|
var state = sm.current_state
|
||||||
var speed = sm.movement_speed
|
# Calculate speed from player's horizontal velocity
|
||||||
|
var speed = 0.0
|
||||||
|
if sm.player:
|
||||||
|
var vel = sm.player.velocity
|
||||||
|
speed = Vector2(vel.x, vel.z).length()
|
||||||
|
|
||||||
match state:
|
match state:
|
||||||
"ground", "idle":
|
"ground", "idle":
|
||||||
|
|||||||
Reference in New Issue
Block a user