fix: calculate speed from player velocity instead of non-existent property
This commit is contained in:
@@ -72,13 +72,17 @@ func _process(delta: float) -> void:
|
||||
if not animation_player:
|
||||
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")
|
||||
if not sm:
|
||||
return
|
||||
|
||||
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:
|
||||
"ground", "idle":
|
||||
|
||||
Reference in New Issue
Block a user