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

growing spider 1 2 3
Growing Spider 3
Download
10 KB


Goal:   A spider moves as it grows.


Screenshot


Vocabulary:   fd (forward), setpos, seth (setheading)

Code
Shapes
Project Map

code


Notes

We are adding fd 5 (or another number) into the grow procedure.   The spider will move forward as it grows.  

  1. Place the spider (turtle) at the top of the web.  

  2. Next we need to set the turtle moving in the right direction.   One way to do this is to return him to a turtle shape: in the command center, type
    setsh 0
    and hit Enter/Return.

    Drag the turtle's head until it is pointing in the direction you want it to go, then put the spider costume back on the turtle.  

  3. Another way to change the turtle's direction is to type seth 130 (or another number) in the command center, and hit Enter/Return.
    Seth stands for "set heading."  
    Seth 0 is straight up.  
    Seth 90 turns the turtle 90 degrees to the right.  
    Seth 130 points the turtle at an angle heading down and to the right.

  4. In this sample grow procedure, the spider increases his size by 2 as he moves forward and grows.   You may try other numbers.

  5. The reset procedure returns the spider to the top of the web again.  
    Setsize 10 makes the spider tiny again.  

  6. Setpos [-173 134] tells the spider exactly where to go on the page.   You will probably want to use different numbers, depending on where you place your spider:

    Setpos stands for "set position," and it is always followed by two numbers.   ( Setpos [0 0] is the exact middle of the page.)  

    The first number tells the turtle how far left or right to go.   A negative number moves the turtle to the left of center, and a positive number moves it to the right.  

    The second number tells the turtle how far up or down to go.   A negative number moves the turtle down, and a positive number moves it up.  

    You can drag your spider exactly where you want it to go, then find out where it is by typing show pos in the command center and hitting Enter/Return.   The computer will output two numbers on the next line.   Those are the two numbers you should place inside the brackets of your setpos command.




What If?
Try having the spider move forward by a different amount.
Try increasing the spider's size by a different amount.


Challenge
Can you place the spider in the top right corner of the web and make the spider move down and to the left while it is growing?
Can you change the reset procedure to send the spider back to this new position on the web?


On Your Own - Project Ideas
Can you use recursion to animate another creature to grow as it moves?





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