Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

ant hill 1 2 3 4 5 6
Ant Hill 1
4 KB

Goal:   Steer an ant with a slider.


Vocabulary:   fd (forward), / (division sign), forever, seth (setheading), setsize

Project Map

to go
t1, forever [fd 1 / 10 seth direction]


This project uses a slider to control the direction that a tiny turtle (ant) moves.

  1. Hatch a turtle.   In the command center, type:
    setsize 13
    and hit Enter/Return.   This shrinks your turtle to a tiny size so that it looks like an ant.

  2. Make a slider named direction.   Sets its minimum to -180 (a negative number) and set its maximum to 180.

  3. In the go procedure, forever means, "Do what is in the brackets over and over again."

  4. Fd 1 / 10 means, "Move forward one-tenth of a tiny turtle step."
    The turtle will move forward slowly.

  5. Seth stands for "set heading."  
    Seth 0 points straight up.  
    Seth 180 points straight down.  
    Seth -90 points straight to the left.
    Seth direction means, "Set the turtle's heading to the value of the direction slider."

    Since the direction slider is set to a minimum of -180 and a maximum of 180, the little ant can point any direction in the circle.   Moving the slider to the left (into the negative numbers) angles the ant toward the left, and moving the slider to the right (past the center) angles the ant toward the right.

  6. Spill green paint to make "grass" for the ant.

  7. Make a go button that calls the go procedure, and try steering the ant!

What If?
Can you steer the turtle in a rough circle around the sugar? Try setting your slider to a minimum of 0 and a maximum of 360.   Compare.

Try different numbers after fd, such as 1 / 2 or 1 / 100 or 1 or 5.   What is a good speed for your ant?

Can you change the name on the slider and change the procedure so that you can still steer the turtle?

On Your Own - Project Ideas
Can you program the color white so that something happens when the ant touches it?

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