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

squares 1 2 3 4 5 6 7
Squares 2
Download
4 KB


Goal:   Draw a thick colored square.


Screenshot


Vocabulary:   setpensize, repeat

Code
Project Map

code


Notes

When the turtle draws a square, it does the same thing 4 times.   It moves forward and turns exactly the same amount.   This project shows how to put identical commands into a "repeat" command.

  1. The turtle can draw lines that are very thin, very thick, or anywhere in between.

    In the square procedure, setpensize 5 tells the turtle to draw thicker lines (5 pixels thick).   Every turtle starts out with a pensize of 1.   You can choose any pensize up to 30.

  2. Repeat 4 means, "Do everything inside the brackets, four times."   Instead of writing:
    fd 100 rt 90
    fd 100 rt 90
    fd 100 rt 90
    fd 100 rt 90

    we can write: repeat 4 [fd 100 rt 90]




What If?
Try a different input (number) after setpensize.
Try a different input after fd.


Challenge
Can you make a rectangle using the repeat command?


On Your Own - Project Ideas
Can you make a picture out of squares or lines of different colors and thicknesses?





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