Change animation of a sprite every xx seconds GDevelop 5.2.169

I wish to change an animation of a sprite every xx seconds (permanently) but my timer isn’t working.

At the beginning of scene | Start (or reset the timer “blip”

The timer “blip” > 10 seconds | change the scene variable NAME: set to Random(3)
Trigger Once

The number of scene var NAME = 0 | Change the number of the animation of SPRITE: set to 1
The number of scene var NAME = 1 | Change the number of the animation of SPRITE: set to 2
The number of scene var NAME = 2 | Change the number of the animation of SPRITE: set to 3

I suspect what happening is… it waits 10 seconds before RND event but nothing after this :frowning:

Can anyone help please?

Thanks,
Rob

After the timer >10 you need to restart the timer with the same action you started it with.

You could also skip the whole bottom part if you set the animation to the random number directly.

1 Like

Hi Rob
If these are your only events then you’re only starting the timer at the beginning of the scene. It needs to start again after changing the animation. Also, you could have

The timer “blip” > 10 seconds | change the animation number to Random(3)
and not even use a variable.

Update, haha, double posting with Keith

1 Like

Muchos Gracias @Keith_1357 / @Bubble.
I really over complicated that one. You’re explanation was 100% spot on - Thank you.

2 Likes