How to make an animation run at a certain time?

So, has anyone here played Commander Keen? You know when you don’t move him for a while, he sits down and pulls out a book? This isn’t the only game with that feature, I’ve seen it in lots. And I want to add it to my newest platformer.

I’ve tried a few different things, but nothing seems to work. Anyone know how to do this?

:+1:

1 Like

maybe use the timer extension

1 Like

Probably just a variable that counts up in a forever block whenever the player velocity X and Y are both 0. If these are ever not 0, the variable gets set back to 0, and I would also set it back to 0 in a “On [any] button [pressed]…” block as well. Then, if the variable is ever over, let’s say 1000, the waiting animation runs! You might have to change the ‘1000’ number until it feels right. It might not be consistent on slower devices, so you could put it in a “On game update every [50]ms…”. Then the number would be more like 400, which would be 20 seconds… might be a bit long, idk.

1 Like

Thanks so much!

:folded_hands:

1 Like

best I could make was this Which checks every ten seconds if the sprite is moving or not. Other than that maybe someone knows a better way to do this.

1 Like

What you could do is just make a simple idle animation, copy and paste the frames until the idle part lasts a while, make the part that happens if the sprite isn’t moving, and set looping to off. If you’re using the animation extension this can break things occasionally, so just make the part that happens after the idle animation last a while and then go back to the idle, and then set the animation to loop.

1 Like