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

#1 2009-09-27 12:53:54

guitar_hero
Scratcher
Registered: 2009-09-27
Posts: 1

How to make timer stop???

I added a timer onto meh game and i just wanna know if there's any possible way to make it stop (like when the game ends it shows you your time until you click flag again)

Offline

 

#2 2009-09-27 16:23:58

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: How to make timer stop???

Do this at a certain time:
<set{ some variable }to( <timer>
<reset timer>


~ihaveamac - visit ihaveamac.net

Offline

 

#3 2009-09-27 16:38:32

06dknibbs
Scratcher
Registered: 2008-01-29
Posts: 1000+

Re: How to make timer stop???

Ihaveamac's way will not work properly i'm afraid  smile

Instead at the end of the game set a variable to a timer like he said but include this other script instead.

"When green flag pressed"
"Reset timer"

Otherwise what will happen is the timer will already be playing after the game has ended, thus resulting in the next game being on something like 48 seconds when it's started.

Last edited by 06dknibbs (2009-09-27 16:44:25)


http://i404.photobucket.com/albums/pp129/06dknibbs/Untitled-3-6.jpg

Offline

 

#4 2009-09-27 17:03:37

weswesrock
Scratcher
Registered: 2009-06-25
Posts: 500+

Re: How to make timer stop???

Make you own timer variable.

Just put:

[blocks]
<forever>
<wait(  1  )secsc>
<change{ TIMER  }by( 1 )
[/blocks]

Offline

 

#5 2009-09-27 21:36:08

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: How to make timer stop???

Tell me what makes the game stop so I can give you a more specific answer please.  smile
For now I willl show you what to do if you are using lives.

Make two variables called "timer" and "lives" then insert this script
<when green flag clicked>
<set{ lives }to( whatever you want
<set{ timer }to( 0
<forever
<wait( 1 )secsc
<change{ timer }by( 1

Then, whatever happens to make the game stop, e.i you run out of lives, then insert the script below.

<If<(lives <=> 0 )>
<say[ timer
<stop all>

I hope this works. My computer is messed up atm so I can't use scratch and test it myself.

                                                                                                -Steppenwulf

Last edited by steppenwulf (2009-09-27 21:59:25)


I'm graduating HS this April and going to college in the Fall.

Offline

 

Board footer