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

#1 2010-09-07 06:47:59

13hoka1
New Scratcher
Registered: 2010-09-05
Posts: 6

Timer display

How do you display the time of for example, how long you survived? Then display at the end of the game?

Offline

 

#2 2010-09-07 07:16:45

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: Timer display

[blocks]<timer>[/blocks] has a checkbox next to it. Click it.

Offline

 

#3 2010-09-07 07:49:01

13hoka1
New Scratcher
Registered: 2010-09-05
Posts: 6

Re: Timer display

no, I mean, for example, at the end of the game, i can put in a box saying: you survived for XXX seconds.

Offline

 

#4 2010-09-07 10:24:24

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Timer display

Good point... The are no show and hide blocks for the timer but you can set a variable to the timer and make that variable show when you what it to.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#5 2010-09-07 21:49:22

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Timer display

You could try using a cover sprite that goes over the timer, too.  smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#6 2010-09-07 22:12:47

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Timer display

Try just "Say [you survived (timer) seconds]"

Make sure to reset the timer at the start of the game. (Darn it, the game!)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#7 2010-09-08 00:09:07

TuffGhost
Scratcher
Registered: 2010-09-06
Posts: 500+

Re: Timer display

This looks like a job for VARIABLES :b

When the timer starts to count how long you survive, put a reset timer block right before, then once the player has died, have a variable (like "survivaltime") and put this in right after:

Code:

set [ survivaltime v ] to (timer)
... when you want to say how long the player survived, put
say (join ( join [You survived ] (survivaltime) ) [ seconds] )

http://i56.tinypic.com/vr8xvs.jpg

Offline

 

#8 2010-09-08 01:00:19

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Timer display

TuffGhost wrote:

This looks like a job for VARIABLES :b

When the timer starts to count how long you survive, put a reset timer block right before, then once the player has died, have a variable (like "survivaltime") and put this in right after:

Code:

set [ survivaltime v ] to (timer)
... when you want to say how long the player survived, put
say (join ( join [You survived ] (survivaltime) ) [ seconds] )

Yes that will work. Or, as he dies, just do:

Code:

say (join ( join [You survived ] (timer) ) [ seconds] )

Hai.

Offline

 

#9 2010-09-08 02:08:21

13hoka1
New Scratcher
Registered: 2010-09-05
Posts: 6

Re: Timer display

could someone tell me exactly HOW to do it in steps, please? I really don't know how to do code.

Offline

 

#10 2010-09-08 03:51:43

13hoka1
New Scratcher
Registered: 2010-09-05
Posts: 6

Re: Timer display

also, should scratch make a "stop timer" block? like, really.

Offline

 

#11 2010-09-08 19:04:50

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Timer display

13hoka1 wrote:

could someone tell me exactly HOW to do it in steps, please? I really don't know how to do code.

Here is the first way: http://i53.tinypic.com/2u70r3b.gif

And my way: http://i53.tinypic.com/2yn57w8.gif

(The cover sprite would be same color as the stage and it would be positioned on top of the timer watcher.)  smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#12 2010-09-09 09:03:19

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Timer display

1.
[blocks]
<when green flag clicked>
<reset timer>
<broadcast[ start game
[/blocks]
2.
[blocks]
<when I receive[ start game
*run scripts for game until game is over*
<broadcast[ game over
[/blocks]
3.
[blocks]
<when I receive[ game over
<set{ text }to( <timer>
<broadcast[ say time
[/blocks]
4.
http://i56.tinypic.com/9a1s15.jpg

Last edited by HD123 (2010-09-09 09:09:38)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

Board footer