# Countdown timer help

**URL:** <https://forum.makecode.com/t/countdown-timer-help/24848>\
**Category:** Help\
**Created:** [December 7, 2023, 6:29pm UTC](https://forum.makecode.com/t/countdown-timer-help/24848 "2023-12-07T18:29:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![techteachtvs](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@techteachtvs](https://forum.makecode.com/u/techteachtvs)\
**Post date:** [December 7, 2023, 6:29pm UTC](https://forum.makecode.com/t/countdown-timer-help/24848/1 "2023-12-07T18:29:27Z")

</div>

Hi,

I’m pretty new to makecode arcade and working on building simple games with my middle school students. One student is creating a basketball shootout game (like the real basketball ones at an arcade) and they are using a countdown timer to give the player 45 seconds to make as many baskets as they can. The student wants the game to beep every second for the last 5 seconds as a warning that time is almost up. I can’t figure out how to make it work! Please advise.

I can’t share their code because it’s on the student’s account not mine.

Thanks.

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [December 7, 2023, 6:37pm UTC](https://forum.makecode.com/t/countdown-timer-help/24848/2 "2023-12-07T18:37:54Z")

</div>

Hey,

here’s a simple version you can start with:

> **[Untitled](https://arcade.makecode.com/S21619-95002-15831-40945)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

this one makes an event that runs every second, checks if the countdown is under 5 seconds remaining (worth a note there’s a bit of a gotcha here - the countdown blocks are in seconds, where most other time related blocks are in ms), and plays a noise if it is.

It’s worth noting that this will not be synced up exactly with the timer; e.g. it’s possible the noise would ring at 4.5 seconds remaining instead of 5 if the countdown is not immediately started. To get the timing a bit better, I think you’d probably have to end up checking each frame & making sure it doesn’t run multiple times in one second. Following link is an example of one way to do that~

> **[Untitled](https://arcade.makecode.com/S21619-95002-15831-40945)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![techteachtvs](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@techteachtvs](https://forum.makecode.com/u/techteachtvs)\
**Post date:** [December 7, 2023, 9:57pm UTC](https://forum.makecode.com/t/countdown-timer-help/24848/3 "2023-12-07T21:57:34Z")

</div>

Thank you! This is very helpful.
