Category: Scratch Coding
Published: Tuesday, 26 January 2016 16:18
Try this one at home... save the attached Scratch file to your PC and then upload it to Scratch. This one has had a few extras added to make it more interactive
- The ASK command asks the user "What shape do you want me to draw?"
- Depending on the ANSWER... we drop into a number of different code blocks
Take a look inside and see if you can add some more! (we don't have a triangle done yet - 3 sides, 120 degrees per turn)
Category: Scratch Coding
Published: Tuesday, 26 January 2016 16:00
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!
You can download your team's scratch code in the attached files below. They are named according to where you were seated in the room. Open your classmates' projects to see how they did what they did! Have a go at remixing some of the code to add your own ideas.