This is a game building block and all code blocks are commented. This block provides an example of how to display a graphical countdown timer and builds upon the Displaying a Score project. Your timer is shown in the top right of the stage and you can start it running by clicking the green tick. Anytime you do this the timer is restarted at the value of the Timer Duration (Seconds) variable slider (a value from 1 to 150). Once the time is up the clock stops and a message is displayed. The clock is created by cloning a single sprite that contains 10 costumes, 1 for each number from 0 through to 9. It is cloned twice for the minutes and twice for the seconds. Each clone knows its position within the clock with the first being the right most digit, the second being the one to its left and so on. Each clone reads the whole input time but concentrates on its corresponding digit and constantly updates itself to make sure what is shown is always correct. An additional sprite provides the flashing dots that separate the minutes from the seconds.
Change the Timer Duration (Seconds) slider and then click the green tick to start the clock ticking down from 1 minute 30 seconds.