Our next project in Scratch Coding was to use a sprite to draw some shapes. We learned a LOT of new controls in scratch such as:
- Moving a sprite to an X/Y position on the screen
- Making a REPEAT loop - so that our snippets of code can repeat over and over (without us having to re-code it!)
- Making a sprite "glide" from one place to another
- How to work with the PEN - by putting the pen up/down and using the "clear" command to wipe the pen lines out!
- How to set the "angle" of our sprite to make sure it is pointing the right way
- How to rotate our sprite through a defined number of degrees
- How to combine all of this to draw shapes!
Our example started off with our sprite (the shark) drawing a 6 sided hexagon. After drawing each side. the sprite rotated clockwise by 60 degrees. This process was repeated 6 times until the hexagon was drawn.
We then worked in our groups to make our character draw all sorts of shapes! We drew:
- squares (4 sides, with a 90 degree turn at each corner)
- hexagons (8 sides, with a 45 degree turn at each vertex)
- circles (by drawing 360 lines, each just 1 pixel long, rotating 1 degree after each line! Remember, computers cant draw curves!... they just join together lots of REALLY small straight lines to make it LOOK like a curve)
Here are some images showing samples of our code:
After we learned how to draw different shapes, we then had great fun, applying ALL of what we'd learned - creating some rather crazy shapes. Check out a couple of our videos below. Somehow.... one of the teams managed to include 5 sprites that were in fact "selfies" of the group.... and a shark from Belfast!