How to code your timer
How to make a timer in Scratch ticking backwards
In this article we will discuss how we can create our own clock ticking backwards in Scratch
Often we need this functionality in our projects.
How it works
Here is the code Snippet for the work.I have keep it simple children to program easily. Create a variable named Timer and sett it to the time 30 sec.
This is the time from where we have to move backwards.
Next step is we have to wait one second as we are making clock and then
change the timer by negative 1. To iterate it until timer becomes less than we need to put hits code in
Repeat Until block.
Extend it to make generic
Let’s extend this code to make it a function or a block in Scratch.
Make a block with the name clock and add input sec to it. Move the same code under the newly created function.
Set Timer to the input value that is Sec in this example.
Now call this clock with different input values to work and see it ticking backward.
Below is the code snippet.