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.
1 Like
Hey,
here’s a simple version you can start with:
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~
3 Likes
Thank you! This is very helpful.