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

#1 2012-10-29 19:14:24

plstrboi
New Scratcher
Registered: 2012-10-29
Posts: 1

Racing game Timer

I have a racing game. How can I record the time it takes to go round the track?

More about the code I already have, when the car(sprite) crosses the finish line the lap variable increases by one. When this happens can I do a time stamp? I also have the timer to reset when the race starts....

Thanks for any guidance.

Offline

 

#2 2012-10-29 20:16:20

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Racing game Timer

plstrboi wrote:

I have a racing game. How can I record the time it takes to go round the track?

More about the code I already have, when the car(sprite) crosses the finish line the lap variable increases by one. When this happens can I do a time stamp? I also have the timer to reset when the race starts....

Thanks for any guidance.

Well there are two ways of going about this. The first way is creating a variable and setting it to the timer at the end of each lap, or if you want to record multiple lap times and not just the last one, you could create a list and add the timer to it at the end of each lap.

I hope that this answers your question!


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-10-29 20:42:25

gfchll
Scratcher
Registered: 2012-04-21
Posts: 100+

Re: Racing game Timer

in scratchblocks form:

when gf clicked 
forever 
change [timre v] by (1) // or any #
wait (1) secs// the number to even out the time
when gf clicked
wait until <touching [start/finish line v] ?>
add (timre) to [list v]

Last edited by gfchll (2012-10-29 20:44:03)


HELLO EVERYBODY!

Offline

 

Board footer