Home Project Folders Resources How Do I? MWForum
Site Map Search Our Team

race cars
 1 
 2 
 3 
 4 
 5 
 6 
Race Cars 1
Try It
17 KB


Goal:   A car races when you use a button to "click on" it.


Screenshot


Vocabulary:   seth (setheading), clickon, stopall, setx

Code Shapes Project Map

to go!
clickon
end

to stop!
stopall
end

to reset
setx -225
end



Notes

In this project, you can make a race car go, stop, and return to its starting position with buttons.
  1. Draw a car shape, or click the "Shapes" button above, and copy and paste a car from the Shapes page of this folder into a shape in the Shapes center of your project.

  2. Hatch a turtle and place the car shape on it.

  3. In the command center, type seth 90 to be sure that the car will drive to the right.   (Seth stands for "set heading."   Seth 0 is straight up.   Seth 90 is 90 degrees to the right.)

  4. Place the eye tool on the turtle to open its dialog box.   Give it the instruction fd 1.   Set it to many times.   Now when you click on the turtle, it will move forward over and over again.

  5. In the go! procedure, clickon is the same as clicking on a turtle (so it will start following its instruction).

  6. In the stop! procedure, stopall stops all of the action on the page.

  7. In the reset procedure, setx stands for "set x coordinate."   Setx tells the turtle how far left or right to be.   0 is the center of the page.   Negative numbers are left of center.
    Setx -225 places the car near the left edge of the page.   You may select a different number, depending on your project size.

  8. Try the different buttons to make the car race, stop, and return to its starting position.



What If?
Try different numbers after setx in the reset procedure.


Challenge
Can you make the car move faster or slower?


On Your Own
Animate another kind of shape in another kind of scene.



© copyright 2001 - 2006  OpenWorld Learning (OWL).   All rights reserved.