Lap-counting
Build up a background and get a new Sprite (a car). On the background you have to add a little line to use as a finish line.
"When the car passes the finish line, you add laps to your score" |
Then choose the block “When green flag is clicked”.
"The car starts when the green flag is clicked" |
“Make a new variable (laps)”
“New blocks will appear”
Drag the one called “Set laps to 0” to the script and attach it to the first one.
Find four points on the race track, in the coordinate system, where the car has to pass by.
- Left
- bottom
- right
- on the finish line
Then take 5 “Wait until”. Depending on which points you have chosen, you have to pick up four blocks called “Bigger than” or “smaller than”. Attach them to the block of before.
Also depending on which points you have chosen, you have to pick up four blocks (“x position” or “y position”). Insert them in four of the “Wait until”.
In the last one, insert a block called “Touching color...”. Add the color of the finish line there. Put everything except the first two blocks in a loop called “Forever”.
No comments:
Post a Comment