This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-22 19:33:31

samrodda
New Scratcher
Registered: 2012-03-18
Posts: 2

Help with time variable and broadcast

I am creating a park your car game. I want the score system to be based on the amount of time it took for the user to complete the level. The user only has 20 seconds to complete each level. When the user has completed the level I have a broadcast that makes a "next level?" text appear and I have their score appear. When the level ends the time variable continues counting down and this changes their score. How do I make it so when the "level 1 done" message broadcasts, it forces the time variable to stop?

Offline

 

#2 2012-03-22 19:47:43

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: Help with time variable and broadcast

well if your script is like this

when gf clicked
forever
wait [1] secs
change [timer v] by [1]
then you should set it to this.
when gf clicked
set [should I stop timer? v] to [0]
When I receive [level 1 done v]
set [should I stop timer? v] to [1]
Now, you should change the very first script to this
when gf clicked
forever
repeat [10]
wait [0.1] secs
change [timer v] by [0.1]
if <<should I stop timer?>=[1]>
wait until <not<<should I stop timer?>=[1]>>
end
end
You should also put
when I receive [new level beginning v]
set [should I stop timer? v] to [0]
That should fix it. Hope this helps.

Offline

 

#3 2012-03-22 20:07:38

samrodda
New Scratcher
Registered: 2012-03-18
Posts: 2

Re: Help with time variable and broadcast

The time variable now stops when the level is completed. Thank you so much!

Offline

 

#4 2012-03-22 20:21:03

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: Help with time variable and broadcast

No problem!

Offline

 

Board footer