Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a custom countdown timer?
- Newton27
-
Scratcher
5 posts
How to make a custom countdown timer?
Hi, I really need some help. I have searched the internet on how to make a countdown timer for a game with custom sprites. The timer must count down but if you collect a mushroom them you get extra time. Please help me!
- congyingzhou
-
Scratcher
1000+ posts
How to make a custom countdown timer?
Hi, I really need some help. I have searched the internet on how to make a countdown timer for a game with custom sprites. The timer must count down but if you collect a mushroom them you get extra time. Please help me!
set [timer v] to (x) // x can be anything you likeI hoped this helped you. Thanks!
forever
wait (1) secs
change [timer v] by (-1)
end
forever
if <touching [mushroom v] ?> then
change [timer v] by (y) // y can be anything you like
end
end
- Newton27
-
Scratcher
5 posts
How to make a custom countdown timer?
Thanks for the help
, sorry for not being clear though. I want to make a timer without using scratches ugly orange and white variables, I want to use my own sprites to display the numbers using variables in the background, if that makes sense. 
, sorry for not being clear though. I want to make a timer without using scratches ugly orange and white variables, I want to use my own sprites to display the numbers using variables in the background, if that makes sense. 
- RokCoder
-
Scratcher
1000+ posts
How to make a custom countdown timer?
There are many text engines that you can use to do that - some of them are pen-based and some of them are sprite-based. Or you can make your own.
Essentially, you need costumes for the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. How to display them depends on whether you're using stamping or sprites. Stamping is probably easier. Step through the digits in the number, select the appropriate costume and stamp it (then update the x coordinate and move on to the next digit).
With sprites you probably want to specify how many you'll need for your timer and create that many clones. From that point the process is similar. Each clone will represent a different digit of the number and needs to select the appropriate costume.
That's more of an overview than an explanation. There are plenty of text engine projects that you can use or look through and I imagine there are probably clearer explanations in the wiki.
Essentially, you need costumes for the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. How to display them depends on whether you're using stamping or sprites. Stamping is probably easier. Step through the digits in the number, select the appropriate costume and stamp it (then update the x coordinate and move on to the next digit).
With sprites you probably want to specify how many you'll need for your timer and create that many clones. From that point the process is similar. Each clone will represent a different digit of the number and needs to select the appropriate costume.
That's more of an overview than an explanation. There are plenty of text engine projects that you can use or look through and I imagine there are probably clearer explanations in the wiki.
- Newton27
-
Scratcher
5 posts
How to make a custom countdown timer?
Thank you RokCoder.
I figured it out
I figured it out
- cubewarrior
-
Scratcher
2 posts
How to make a custom countdown timer?
here is a simple timer
when green flag clicked
set [timer] to []
when green flag clicked
forever
set [ timer] to (((round (timer)) * (10)) / (10))
- DUYdeptrai2019
-
Scratcher
93 posts
How to make a custom countdown timer?
here is a simple timerWhy Reply To A 2 Years Old Topic? It's Called Necroposting By The Way.when green flag clicked
set [timer] to []
when green flag clicked
forever
set [ timer] to (((round (timer)) * (10)) / (10))
- Discussion Forums
- » Help with Scripts
-
» How to make a custom countdown timer?