This month’s event at the Sharp Project was a great success, not least because of the superb space that we are able to use. As well as the huge ground floor area (known as “The Campus”) we have the facility to use a large self-contained room upstairs (“Gold 150”) which has a big screen and plenty of table space, chairs, power and wifi (add coffee, and you have the essentials for any programmer!)
We used this room for a couple of related sessions that were focused on our younger coders and budding coders: Scratch for Beginners, and an Intermediate Scratch follow on session. Both sessions were very well attended, and I think it’s fair to say that everyone – the kids, the parents, the helpers, and me – had a great time.
Scratch for Beginners
With the Scratch for Beginners session we all built together, step by step, a simple Aquarium, getting to grips with the user interface of the Scratch environment (we used Scratch 2.0 online) and finding out about Sprites, Costumes, the Stage, Backdrops and of course Scripts. We took a heuristic approach to getting some fish to swim around, fixing problems that cropped up one at a time:
- “How can I get the fish to swim without having to keep clicking the ‘move’ block?”
- “Why is the fish stuck off the side of the screen?”
- “Why is the fish swimming upside down?”
- “How can I get more than one fish?”
and so on. It’s important to help newcomers to become comfortable with the development environment and I think at the end of the session, they were.
One common challenge with understanding in Scratch is the difference between a sprite and a costume. We spent time making sure that the kids grokked the difference.
Building on the previous session, we then spent an hour working towards a “Tamagochi Aquarium”. This is a tank where you can bring fish to life with a click, have them created with an initial random speed, size, costume and direction, and with an initial number of energy points. As they swim around, their energy is slowly depleted, and at a certain stage a fish will tell you that it’s hungry. Unless you feed it (by clicking on it as it moves) the energy eventually falls to zero and the fish disappears with a ‘pop!’
We managed to get through a lot of the construction, right up to the point where we are now ready to add the energy points / hunger mechanics. This is what we coverered:
- Modularisation of code: we defined the “fish setup” and the “fish swim” code sections as new blocks (with “More Blocks“, a Scratch 2.0 feature) and reused them when we needed.
- Random numbers and maths: we used the random number generator a few times in different contexts, and one fun part was determining the initial size of a newly spawned fish with a random number between 1 and 4, multiplied by 25, then applied as a size percentage to the sprite. We went through this “by hand” first, and it was a lot of fun.
- Conditions: We used if..then..else to decide on an initial direction, from a random binary option (I didn’t use the word binary but we got the idea that there were only two possibilities). Further, we looked at the diamond shape that represented a condition and examined various condition mechanics (in the Operators category) and talked about a condition being either true or false, one or the other, relating that in turn to the then and else of the if statement.
- Variables: Of the concepts introduced, this was probably one of the toughest, although they got straight away (it was their suggestion) that a variable is all about “varying”. We used a variable to store a sprite’s speed and then referenced it in the Move Steps block.
- Cloning: Not particularly a programming concept, but we used Scratch 2.0’s cloning feature, to be able to create more fish. This had the agreeable side-effect, however, of underlining the concept of events, for example, with When I start as a clone, and also of instance variables(!) – every sprite had their own initial size, speed, costume, direction. Again, I didn’t use the term “instance” but the concept of different copies of variables, with their respective values, was something that we covered.
So all in all I think a successful session. And special thanks to Anisha and Amanda for being great helpers! Next time we’ll build in the energy points / hunger mechanics – something to look forward to!
But if you can’t wait, I’ve shared the complete Tamagochi Aquarium for you to have a look at, play with, and most importantly, build upon and improve.
Share and enjoy!