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

#1 2009-12-21 18:07:03

avatarl8
Scratcher
Registered: 2009-01-01
Posts: 11

Timer

I need to make a time that can be stated when I need it to and stop and restarted when I tell it to. The timer built in can't be restarted from 0. (I think)

Any suggestions?

Offline

 

#2 2009-12-21 22:39:49

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: Timer

Create a variable and make it change every second unless certain constraints are placed on it.

For example:

If you wanted to make the timer stop when a sprite touches a certain color, you would use this:

[blocks]

<when green flag clicked>
<forever>
<if><touching color[
<wait until><<  <not>  >> <touching color[
<end>
<else>
<wait( 1 )secsc>
<change{ timer }by( 1
[/blocks]

Of course at the beginning you would set the timer to zero

On a completely unrelated note, shouldn't this be in All about Scratch?


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#3 2009-12-22 02:36:43

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: Timer

<reset timer>

that block will reset the timer to 0 ^^

Last edited by Dibbo222 (2009-12-22 02:36:56)


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

Board footer