hi I was just wondering how to make a lap counter for a car game
can anyone help me with this?
Offline
The above post has been moved from http://scratch.mit.edu/forums/viewtopic.php?id=100761 to its own thread.
Offline
Make a blue line to mark each lap. Make a variable that says LAP. Use the following script:
when gf clicked forever if <touching color[#0000FF]> change [LAPS v] by (1) end end
Offline
sonicgames20 wrote:
Make a blue line to mark each lap. Make a variable that says LAP. Use the following script:
when gf clicked forever if <touching color[#0000FF]> change [LAPS v] by (1) end end
This has one flaw. You can just go around in circles and get loads of laps. To prevent this you need to make it impossible to reverse and/or have a colour surrounding the track it sends you back to just after the lap line.
Offline
JH1010 wrote:
sonicgames20 wrote:
Make a blue line to mark each lap. Make a variable that says LAP. Use the following script:
when gf clicked forever if <touching color[#0000FF]> change [LAPS v] by (1) end endThis has one flaw. You can just go around in circles and get loads of laps. To prevent this you need to make it impossible to reverse and/or have a colour surrounding the track it sends you back to just after the lap line.
Or put a few lines in the lap that match the background so the player can't see them, and to get a lap you have to pass over all of them in order.
Offline
benjamin2 wrote:
Or put a few lines in the lap that match the background so the player can't see them, and to get a lap you have to pass over all of them in order.
This works but you don't need to worry about people seeing them; just set the ghost of the lap lines to 99.
Offline