Goal: Draw many squares of different sizes, colors, and thicknesses.
Vocabulary: savepict, loadpict, / (division sign)

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.
- Add a slider called howmany to be used in a new manysquares procedure. Set the minimum to 3 and the maximum to 100.
- 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.
- Make a button named manysquares for running the procedure.
- 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.
- 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?
|