Earworm
New 10th anniversary edition of my acclaimed novel about what happens when AI and the music business collide.
Sean McManus, author of Scratch Programming in Easy Steps and Cool Scratch Projects in Easy Steps, shows you how to add a timer to your Scratch game
One way to add an element of challenge to even the simplest of games is to add a time limit. A countdown on-screen and a rising sound effect can help to heighten the tension. My 10-block demo below does all of this for you. You can add it to any game to add a 30 second time limit, and can adjust the time limit to any number you want.
You can put this script on any sprite or on the background. If your sprite already has other scripts on it, add the timer script as an additional script on the sprite. Don't try to combine them, otherwise you're likely to slow your game down because of the 1 second wait in the loop here.

You can see my Scratch timer demo below. I added a moving cat, just so you can confirm that the script stops when the timer reaches zero.
Find more 10 block Scratch demos here. For more information on my Scratch books and more bonus content, visit the Scratch Programming in Easy Steps and Cool Scratch Projects in Easy Steps homepages.
© Sean McManus. All rights reserved.
Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!
New 10th anniversary edition of my acclaimed novel about what happens when AI and the music business collide.
A free 100-page ebook collecting my projects and tutorials for Raspberry Pi, micro:bit, Scratch and Python.
Web Design in Easy Steps, now in its 7th Edition, shows you how to make effective websites that work on any device.
Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.
This book, now fully updated for Scratch 3, will take you from the basics of the Scratch language into the depths of its more advanced features. A great way to start programming.
Code a space adventure game in this Python programming book published by No Starch Press.