# How to make an animation run at a certain time?

**URL:** <https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857>\
**Category:** Help\
**Tags:** game, graphics-and-math, art\
**Created:** [March 24, 2025, 12:25pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857 "2025-03-24T12:25:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dogSquid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dogsquid/32/26689_2.png) [@dogSquid](https://forum.makecode.com/u/dogSquid)\
**Post date:** [March 24, 2025, 12:25pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/1 "2025-03-24T12:25:22Z")

</div>

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?

👍

---

<div class="post-metadata">

**Author:** ![ShaneyBoi09](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shaneyboi09/32/18893_2.png) [@ShaneyBoi09](https://forum.makecode.com/u/ShaneyBoi09)\
**Post date:** [March 24, 2025, 8:47pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/2 "2025-03-24T20:47:54Z")

</div>

maybe use the timer extension

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [March 24, 2025, 9:47pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/3 "2025-03-24T21:47:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dogSquid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dogsquid/32/26689_2.png) [@dogSquid](https://forum.makecode.com/u/dogSquid)\
**Post date:** [March 25, 2025, 6:22am UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/4 "2025-03-25T06:22:34Z")

</div>

Thanks so much!

🙏

---

<div class="post-metadata">

**Author:** ![zef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/zef/32/28163_2.png) [@zef](https://forum.makecode.com/u/zef)\
**Post date:** [March 25, 2025, 12:53pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/5 "2025-03-25T12:53:33Z")

</div>

best I could make was [this](https://arcade.makecode.com/S34022-09443-56392-25635) Which checks every ten seconds if the sprite is moving or not. Other than that maybe someone knows a better way to do this.

---

<div class="post-metadata">

**Author:** ![Nave](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/nave/32/20447_2.png) [@Nave](https://forum.makecode.com/u/Nave)\
**Post date:** [March 25, 2025, 1:12pm UTC](https://forum.makecode.com/t/how-to-make-an-animation-run-at-a-certain-time/34857/6 "2025-03-25T13:12:23Z")

</div>

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.
