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 5
Download
14 KB


Goal:   Draw many squares of different sizes, colors, and thicknesses.


Screenshot


Vocabulary:   savepict, loadpict, / (division sign)

Code
Project Map

code


Notes

In this project, the computer does the math as the turtle draws a design of many evenly-spaced squares.   We also save and load pictures as external graphics files.

  1. Add a slider called howmany to be used in a new manysquares procedure.   Set the minimum to 3 and the maximum to 100.  

  2. In the manysquares procedure, howmany is used twice in this command:
    repeat howmany [square rt 360 / howmany]

    Repeat howmany tells the turtle how many squares to draw.
    Rt 360 / howmany tells the turtle to divide 360 by the number on the howmany slider when turning after drawing each square.   In this way, the squares are evenly spaced.

  3. Make a button named manysquares for running the procedure.

  4. You may overlap several designs on top of each other.   When you get a design you really like, you can save it with a command in the command center like this:

    savepict "picturename.gif

    (Choose your own picture name instead of picturename.)
    The picture will be saved as a separate GIF file in the same folder as the project, without any of the buttons or sliders showing.

    If you leave off the .gif at the end of the file name, then the picture will be saved as a bitmap (PC) or a PICT file (Mac).   That is fine, but these files will be larger in size.

  5. You can load the picture back into the project with:
    loadpict "picturename




What If?
Try setting the sliders to different numbers.


Challenge
Can you make a design out of several layers, keeping howmany set to the same number for each layer and changing some of the other slider values?


On Your Own - Project Ideas
Using the savepict command, create a series of picture files which show each new layer in a multi-colored design.   Write a procedure using loadpict to load each picture to make a little slideshow.   Include a wait command (such as wait 15) after each loadpict command.





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