Home
Project Folders
Teacher Resources
Student Resources
En ESPAÑOL
How Do I?
Vocabulary
MWForum
Site Map
Search
Our Team

race cars 1 2 3 4 5 6
Race Cars 2
Download
5 KB


Goal:   Two cars race at different speeds.


Screenshot


Vocabulary:   everyone

Code
Shapes
Project Map

code


Notes

To race two cars at different speeds:

  1. Hatch a second turtle and put a second car shape on it.   Drag it so it is roughly lined up with the first car.

  2. Everyone means that we will be talking to each of the turtles in turn, no matter how many.   Put the instruction list in brackets.

    In the command center, type everyone [seth 90] to be sure that both cars will drive to the right.

  3. In the reset procedure, everyone [setx -225] lines up both cars at the same x coordinate.   (You may choose a different number to fit your project size.)  

  4. Place the eye tool on one turtle to open its backpack, and give it the OnClick rule fd 1.   Set it to Forever.

  5. Place the eye tool on the other turtle and give it the OnClick rule fd 2.   Set it to Forever.  

    Now when you click on a turtle, it will move forward over and over again.

  6. In the go! procedure, everyone [clickon] is like clicking on each of the turtles in turn very fast.   This way, both cars can start the race, but they can each follow their own instruction.




What If?
What if each car moves forward by a different fraction,
such as fd 1 / 2 or fd 1 / 3?


Challenge
Can you give each car a different starting position in the reset procedure so that they both reach the right edge of the project at the same time?


On Your Own - Project Ideas
Can you animate two or more shapes in another scene?





© copyright 2001 - 2016  OpenWorld Learning.   All rights reserved.