Playing, with Scratch

With a Code Club at a local school due to start soon, I downloaded Scratch and started to learn about what it could do.

Scratch is a simple programming environment which introduces the concept of scripting through an easy to understand interface. It begins with a stage, upon which you can add characters, or “sprites.” Each sprite can have multiple costumes, which you can use to animate the sprite. You can move the sprite around the screen and change the background of the stage. You can also add sounds. From this you can create games, animations, tutorials, and all sorts.

Scratch comes with a library of ready made sprites, backgrounds and sounds, but you can also paint your own backgrounds and sprites from within Scratch. Better yet, you can also import images of any graphic type, meaning you can spend more time using software like GIMP. You can even import images directly from a web cam.

The same goes for sounds – you can import any sound, and if you have a microphone, you can record your own sounds.

Scripts for car 2, click for bigger

The scripting is performed in the form of colourful drag and drop blocks that clip into each other to form instruction sets. You can attach these scripts to sprites and to the stage itself. Variables can be created for individual sprites or the globally.

An example of a set of scripts attached to a car in my game can be seen in the image – click the image for a bigger view. There are limitations with the scripting that a developer might cringe at, the main one for me being a lack of code re-use, if you have multiple sprites with the same behaviour, you have to duplicate the script to each sprite, which means if you change the behaviour on one, you then have to change the script on all the other sprites – or re-copy the script and delete the old one.

When you’ve finished a project, you can upload to the Scratch servers, where others can run your project, download it, and “remix” it, which is basically like forking on github.

So, this is my first project. Technically it’s my second; the first release had a bug and while fixing that bug I decided to implement two of the improvements I’d suggested in the project notes for remixers. It’s a 2 player car game, where you have to knock each other out of an ever decreasing circular platform. It’s based on an old Public Domain Amiga game that I once played written in AMOS.

I’m now considering whether to implement a rudimentary AI system for single player mode but I might leave that to others.

The final project for code club is for the students to design and create their own game.  I may use this as an example.

You can see the project and download it from http://scratch.mit.edu/projects/andrewdj/2897740

Leave a comment

Your email address will not be published. Required fields are marked *