Godot Version
Godot 4.6.3
How do I fix the spin_jumping spin animation only playing a single frame?? What I’ve got here is the snippet of my func _physics_process() that handles the animation side of my CharacterBody2D.
if velocity.x:
if p_meter == 1.867:
$AnimatedSprite2D.play('run')
else:
$AnimatedSprite2D.play('walk')
var frame_rates_by_speed: Array[float] = [1.0, 1.25, 1.5, 2.0, 3.0, 4.0, 6.0, 6.0]
var index: int = int(abs(velocity.x) / 30)
index = min(index, 7)
if is_on_wall() and direction * velocity.x > 0:
index = 3
$AnimatedSprite2D.speed_scale = frame_rates_by_speed[index]
else:
$AnimatedSprite2D.play('idle')
if direction * sign(velocity.x) == -1:
$AnimatedSprite2D.play('turn')
$AnimatedSprite2D.flip_h = facing_dir < 0
if not is_on_floor():
if not spin_jumping:
if velocity.y > 1:
$AnimatedSprite2D.play('fall')
else:
$AnimatedSprite2D.play('jump')
jumping = true
else:
if $AnimatedSprite2D.animation != 'spin':
$AnimatedSprite2D.play('spin')
$AnimatedSprite2D.animation = 'spin'
move_and_slide()