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

#1 2012-03-09 06:42:22

jellyfishmj
New Scratcher
Registered: 2012-03-09
Posts: 2

how do you use the timer?

i am trying to make a game which is like,
you have 5 lives and have to survive for 30 seconds but if you lose all 5 lives before 30 seconds, you lose
can you help me with it?
thank you  big_smile

Offline

 

#2 2012-03-09 07:23:54

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: how do you use the timer?

when gf clicked
wait until <<(lives) < [1]> or <(timer) > [30]>>
if <<not <(lives)=[0]>> and <(timer)=[30]>>
broadcast [you win v]
if <(lives) < [1]>
broadcast [you lose v]
Replace the = with >, but this breaks the system so I can't show it.

Last edited by scimonster (2012-03-09 07:26:59)

Offline

 

#3 2012-03-09 09:40:26

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: how do you use the timer?

scimonster wrote:

when gf clicked
wait until <<(lives) < [1]> or <(timer) > [30]>>
if <<not <(lives)=[0]>> and <(timer)=[30]>>
broadcast [you win v]
if <(lives) < [1]>
broadcast [you lose v]
Replace the = with >, but this breaks the system so I can't show it.

Add a "reset timer" block to the beginning if you don't have that in another script.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-03-09 11:22:55

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: how do you use the timer?

To be honest, I wouldn't. I would use a variable for the timer. The timer is very unreliable and you can't manually change it.


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

Board footer