Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Can you stop the timer?
- mwiedmann
-
100+ posts
Can you stop the timer?
You shouldn't reset the timer because then you can't have multiple time based events in your program.
If you have events that need to occur every X seconds, the best thing to do is to create a variable to handle each one. That way you don't have to reset the timer. Let's say you have a game and want to create an alien ship every 10 seconds. You would:
1st create a variable “AlienTimer”
When GF Clicked
Set AlienTimer = timer
Forever
If AlienTimer + 10 < timer Then
create clone of alien
Set AlientTimer = timer
If you have other timed events you just create another variable for each event and handle the same way.
If you have events that need to occur every X seconds, the best thing to do is to create a variable to handle each one. That way you don't have to reset the timer. Let's say you have a game and want to create an alien ship every 10 seconds. You would:
1st create a variable “AlienTimer”
When GF Clicked
Set AlienTimer = timer
Forever
If AlienTimer + 10 < timer Then
create clone of alien
Set AlientTimer = timer
If you have other timed events you just create another variable for each event and handle the same way.
- Tezliov
-
71 posts
Can you stop the timer?
You can't stop the timer, but you can reset it or make a variable set to it, which will freeze the timer in the variable.
Last edited by Tezliov (June 19, 2013 15:16:32)
- xlk
-
100+ posts
Can you stop the timer?
you can make a timer, have a variable that is constantly changed by 1, you could stop that. Be warned, you wouldn't have a seconds timer, but a frame timer…
- clubby789
-
54 posts
Can you stop the timer?
You can't stop the timer, but you can reset it or make a variable set to it, which will freeze the timer in the variable.
I was going to say that!
- Discussion Forums
- » Help with Scripts
-
» Can you stop the timer?