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

#1 2010-05-26 04:00:52

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Timers help please!

Have made a simple racing game with two lines on track.  These lines are sprites.

I Want to be able to make a counter go up every time you touch the second one, but only if the first one has been touched.

I also want a timer to stop at 10 laps.

About to load up what i have done so far, please help!

Thanks

Offline

 

#2 2010-05-26 06:02:30

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Re: Timers help please!

Can anyone help me please?

Please visit my game at

http://scratch.mit.edu/projects/HotHead25/1076812

Offline

 

#3 2010-05-26 06:37:30

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Re: Timers help please!

You should try using variables instead. I think those would help. Tell me if you need any other help.


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#4 2010-05-26 07:08:03

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Re: Timers help please!

Thats the problem i dont understand variables.

Any way you can explain to me please?

Offline

 

#5 2010-05-26 07:35:34

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Timers help please!

Create a variable by the name of Timer.
When the race starts, continuously change the timer by 1.
When it ends, stop it.
The variable is now a timer.

Hope that helps  smile

If you need any sort of specific script, don't hesitate to ask!

Offline

 

#6 2010-05-26 08:24:54

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Re: Timers help please!

hey man can you please set up a timer on a simple level that i can study please.

If it is not too much trouble.

I'll add you to my friends list.

Thanks

Offline

 

#7 2010-05-26 08:28:26

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Timers help please!

You should add the value of the timer to a list every time the car crosses the finish line, and then reset the timer. I'll put an example together.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#8 2010-05-26 08:44:54

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Timers help please!

I added a timer and a list that records your lap times here:
http://scratch.mit.edu/projects/halfbaked_fullmoon/1077129
Let me know if it's what your looking for.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#9 2010-05-26 11:47:04

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Re: Timers help please!

Its brilliant!

But how can i get it to say your total time?

Offline

 

#10 2010-05-26 16:06:20

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Timers help please!

HotHead25 wrote:

Its brilliant!

But how can i get it to say your total time?

Add the items of the list together. For example, if you want 3 laps, use this script:

Code:

set Total to ( ( (item (1) of list) + (item (2) of list)  ) + (item (3) of list) )

Offline

 

#11 2010-05-26 17:13:26

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Timers help please!

Code:

set i to 0
set total to 0
repeat (length of [list]):
  change i by 1
  change total by (item (i) of [list])

http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer