Goal: Find the turning angle to make other polygons.
to polygon
pd
setc whatcolor
repeat #sides [fd howbig rt angle]
end
to reset
cg
end
Notes - Make a new slider called #sides. Set its minimum to 3 and its maximum to 60 (or another number of your choosing).
- Make another slider called howbig. Set its minimum to 5 and its maximum to 200.
- Write a polygon procedure as shown.
- Make a button called polygon and set it to once.
- Experiment with different inputs for #sides and angle to see if you can make different polygons (such as a pentagon or a hexagon). How many degrees does the turtle turn in all to complete a closed shape?
What If?
Can you set the #sides and angle sliders to draw a square, pentagon, hexagon, and octagon? (Keep track of the angle needed to draw each polygon.)
Challenge
Can you change the name of a slider and change its name in the procedure so that the polygon button still works?
Can you write procedures and add buttons to draw a square, pentagon, hexagon, and octagon (using numbers instead of #sides and angle)?
|