Goal: A car races when you use a button to "click on" it.
Vocabulary: seth (setheading), clickon, stopall, setx
In this project, you can make a race car go, stop, and return to its starting position with buttons.
- Draw a car shape, or click the "Shapes" button, and copy and paste a car from the Shapes page of this folder into a shape in the Shapes center of your project.
- Hatch a turtle and place the car shape on it.
- 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.)
- Place the eye tool on the turtle to open its backpack. Go to the Rules tab and set the OnClick rule to fd 1. Set it to Forever. Now when you click on the turtle, it will move forward over and over again.
- In the go! procedure, clickon is the same as clicking on a turtle (so it will start following its instruction).
- In the stop! procedure, stopall stops all of the action on the page.
- 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.
- Try the different buttons to make the car race, stop, and return to its starting position.
Try different numbers after setx in the reset procedure.
Can you make the car move faster or slower?
On Your Own - Project Ideas
Animate another kind of shape in another kind of scene.