1) Draw a square
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUN8Cp8DrxDmXjoqlaJqQlUFyWBDtZzMlqSqE1V1V_KBSi9yk26ZMwAum0ZL0pMSQpuF_Ch-skXtgNMno5tIpKcKtFSHsbYmAaUWWB-ykec1HyuH2tCZKImNTnx2fufzTt-8w/s320/sq.jpg)
Initially setup so the cat draws a square of 50 steps, starting initially facing upwards
Point in direction 0 (up)
repeat 4
move 50 steps
turn 90 degrees
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghAGokTmhprKGZtYMlQAWyuF7Pvs2XK_SrJMQJWI6C28-Axpgnut2x2mcOMUR5HYxvqQAFZRnCOCBkNDqJPS7gvGHlxThH1T0FwhfQw1vlutTkYDlvwjB9vYqQmpGwyFksckQ/s320/sqPic.jpg)
2) Create two variables: side and angle
Set the angle to 360 / side
Insert the side and angle variables into the polygon procedure as shown:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR4i-6-NCs-kfHkM6PoPg6OYAIbXftyAGvwMsJX8jl_fXV1ORNfnI90ho_H2ZC5NyatYNkO9QCGvnPQ3Y7_ZASt12JKWbgqdwE3Gv1BUJBfgpFl_N4h-SKjUK_Pk1N203-U4U/s320/sideAngleVariable.jpg)
Use the repeat procedure to draw some different shapes (triangle is shown)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIFhg0f-sjfpSxYQ9WTknN01P8mLMP32z5Ei0RMAneDbVeBJdHMPH5HsyBXqoVu67Ubc4oEkBjb5yu_v2w25wcy-JEpDMqRlbAXqgIXRcg-75jMcAhI75bAFyrCNN5eWtAHds/s320/triangle.jpg)
3) Use the Number, Variable and Control blocks to setup a repeat until, as shown:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghp28Fmw7DvQbT1SiQRMSfi_lrvhIHa8_zlV9EBfkCY7jYmt6oDyh6_eK1aLSyQu49WZiFo0-hO1dyhg5kP-F-8GxQ9_NY4LD-qTeaCicCMo5pL4H_AbFhlCgARfoh4SdBQto/s320/repeatUntil.jpg)
Now insert the procedure inside the repeat until:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8vo6BVNjrPDpcezvWQd8RXPuISpg5_lJYqfyIsKVuHvR3ft-nfzAA5ifw6DfZHWW0DjUnZt5qC64f5bdGrBMxohQRi23VEcxGFFM1-Bbu2Lh3vjpVCb9lwGPHt3B7yuqMdAk/s320/finishCode.jpg)
Now draw all the shapes at once, 3 to 8 sides:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk6-eZOqFOWr7UnNG_WAEaPVE2cMTBbgkfSIxfDFCVHUiNuZELixIdk1iGxslnVv9ay-fc9upAS1A2bDJt-1L25sR2TihxJp3wgJWeOJL_lczCWD_Da03fGpE_5G-buABqiOU/s320/finishPoly.jpg)
No comments:
Post a Comment