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

obstacle course
 1 
 2 
 3 
 4 
 5 
 6 
 7 
Obstacle Course 5
Try It
19 KB


Goal:   Put the turtle back where it started.


Screenshot


Vocabulary:   show pos, setpos, seth (setheading) -90

Code Shapes Project Map

to start
t1, clickon
end

to reset
setpos [228 -92]
seth -90
stopall
end



Notes

Be sure the turtle has the instruction fd speed / 10 and is set to many times.
  1. Drag your turtle to the spot where you want it to start.   In this sample, the turtle starts near the bottom right corner of the project page.

  2. Now we will find the coordinates for this position.  

    The computer uses two numbers to tell where your turtle is.   0 0 is the exact middle of your project page.

    The first number is the "X coordinate" and tells how far your turtle is to the left or right of center.   A negative number (such as -150) is left of center.   A positive number (such as 150) is right of center.

    The second number is the "Y coordinate" and tells how far your turtle is above or below the center.   Positive numbers are above the center and negative numbers are below the center.

    In the command center, type show pos and hit Enter (or Return).   On the next line you will see two numbers.   Those are the X and Y coordinates for your turtle's position.

  3. Write a reset procedure.  
    In the sample procedure above, setpos [228 -92] means: "Place the turtle 228 tiny turtle steps to the right of center and 92 steps below center."  
    Use your turtle's coordinates (instead of these sample numbers) to place your turtle where you want it.

  4. Seth stands for "set heading."  
    Seth 0 points the turtle straight up, and seth 90 points him to the right.  
    Seth -90 points him to the left.   There are 360 degrees in a circle.   Seth 270 is another way to point the turtle to the left.   (It is the same as saying either "2:45" or "quarter to 3" when looking at the hands on a clock.)



What If?
Try writing different numbers in the setpos command:
What happens if both numbers are positive?
What happens if both numbers are negative?
What happens if the first number is negative and the second number is positive?


Challenge
Can you drag your turtle to another corner, find its position, and then change the X and Y coordinates and the heading so the turtle will always return to this position? (Move the pond to a different corner, too.)

Can you find the position of the center of the pond?

Can you change the instruction for the blue color so that the turtle will move into the pond, wait a little bit (wait 20 or another number) or move a little bit, and then return to its starting position?


On Your Own
Try drawing a different scene with a wide path and write a reset procedure so that the turtle is ready to start at the beginning of the path.



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