How to align sprites with gameplay?

Godot Version

4.2.2

Question

I have a Shooter Node2D that spawns Area2D projectiles based off of a timer that I can set per shooter.

The Shooter needs to somehow warn the player when it’s about to shoot, therefore it needs an AnimatedSprite2D to accomplish that goal.

Problem: Doing this with the timer is horrible. I have the animation set up the way I like it, it’s 12 frames running at 24FPS, making the animation last half a second. (I can’t upload the screenshot of the sprites, sadly)

This is the way I tried to make this work:

func _process(delta):
	if shoot_timer.time_left < 0.5:
		sprite.play("Spawning")
	else:
		sprite.play("Idle")

This causes desyncs, which I’m guessing is to blamed on timer shenanigans, though it could be something else.

How do I make it so that we can have projectile spawn times close to and less than half a second, while also making sure that it doesn’t desync too easily?

Have you tried using AnimationPlayer (with Sprite2D instead of AnimatedSprite)? There you can setup the exact synchronization with keys