Review of ScratchJr on the iPad, including how to write an arcade game
Sean McManus, author of Scratch Programming in Easy Steps and Cool Scratch Projects in Easy Steps, shows you how to write a simple arcade game using ScratchJr in this review of the new iPad programming app.
If you have younger family members who aren't quite ready for Scratch yet, try ScratchJr, a free iPad app that brings the fun of programming to even younger audiences. It's aimed at children aged 5 to 7 years old, and has been simplified so it's easy for them to get results. There is very little text used (just a few labels for sprites and projects), and intuitive icons make it easy to create animations and interactive stories.
Here's what the interface looks like:
The app opens with a video that shows you how to use the interface, but some of the important elements are:
- Sprite List: In the top left corner you can see a list of the sprites in this project. Sprites are pictures that you can make move or do other things by writing scripts (short programs) for them. Tap the plus sign here to add a new sprite from the library, which includes lots of pictures of animals and children, and a few other objects and characters too. I'm pleased to see that our friend the Scratch cat is here!
- Stage: The large picture, here of a desert scene, is the Stage. This is where the action takes place: where the sprites move and interact.
- Backdrop: Tap the picture of a landscape above the Stage and you can change the background of the Stage.
- Scenes: In the top right you can add a new scene. This gives you a blank Stage with the Scratch cat. You can move to a new scene by using one of the red blocks in your script. Scenes are useful for creating different scenes in a story (the most likely use) and could be used for creating different levels in a game too.
- Blocks Palette: In the screenshot, there is a stripe across the middle of the screen, half of it blue. The buttons on the left side of this stripe let you choose between different types of blocks. These are Control blocks, Movement blocks, Looks blocks, Sound blocks, Timing blocks and End blocks. When you tap one of these buttons the relevant blocks are shown on the right. In the screenshot, the Motion blocks are shown.
- The Scripts Area: At the bottom, you assemble scripts (short programs) for your sprites by dragging blocks in from the Blocks Palette above. Each block is a command. You put them in order, from left to right and join them together. To choose which sprite you want to make a script for, tap it in the Sprite List first. Each sprite can have more than one script on it.
In the above, I've used some of the terms from Scratch (as opposed to ScratchJr), but children don't need to know any of the jargon. It just makes it easier to tell you about the ScratchJr app, especially if you're already a Scratch user.
What's the difference between ScratchJr and Scratch?
There are some limitations compared to the full version of Scratch, which is aimed at an older audience. There are no variables, for example, and sprites can only rotate in 15 degree increments. The grid for positioning sprites is just 20 squares wide and 15 squares tall. There isn't a block to move to a particular position, but you can reset the block to its starting position. The forever block can only repeat a whole script. These limitations are exactly what make it suitable for younger children, though, and make it easy for them to get rapid results.
There are some nice surprises too: broadcasts are supported. You can detect when a sprite touches another sprite (although you can't detect which sprite it's touching, as far as I can see). You can trigger scripts when a sprite is tapped, although you need to take care that you don't tap and hold a sprite because that brings up the option to delete the sprite. There's a nice additional block to make a sprite jump up and come down again. Sound recording is integrated too, so users can easily personalise their games.
Overall, ScratchJr is much simpler but still includes enough options to enable children to express themselves creatively. I can imagine that some children will explore ScratchJr and then move on to Scratch later on, especially those who discover ScratchJr when they are closer to 7 years than 5 years old.
Writing a game with ScratchJr on the iPad
So how sophisticated is it? Well, you can create simple games with it. Here's an example of a game, where you shoot a ball and try to hit the alien. To make this game, just add the sprites shown below, and give them the scripts shown beside them. The blocks are colour coded, which should make it easy to find them.
In this game, you tap the cat to fire the ball at the alien. The ball should be at the bottom of the screen, and the alien should be at the top. The cat can go in one corner, where you can easily tap it without obscuring the screen. This is the same game you can see in my screenshot above.
Here's what the scripts do:
- When the cat is tapped, it sends a broadcast. There are six different broadcasts to choose from, which use different colours.
- When the game starts (by tapping the green flag), the ball goes to its starting position.
- When the ball gets the broadcast message, it goes to its starting position, and moves up the screen 15 steps. That means it ends up back where it started, because sprites that go off the top of the screen come back on the bottom, and the screen is 15 units high.
- When the green flag is tapped, the alien sets its speed to fast, goes to its start position, and moves right 15 steps and then left 15 steps. The red block repeats the whole script.
- When the alien touches another sprite (which could only be the ball in this game), it says "Ouch!" and makes a pop sound.
In reality, ScratchJr isn't ideally suited to gaming applications and probably isn't what most children will want to create with it, but that example gives you an introduction to some of the features of the language. I think most children will probably want to use ScratchJr to tell stories, creating their own art and sounds, and making the characters interact. This is similar to how many children use the more sophisticated Scratch language now, and the most important thing is that young people have a new way to express themselves creatively on the iPad. Although the aim is not to teach young chidren to program, they will be exposed to some key programming concepts along the way, which will make it easier for them to progress to programming later.
I'm delighted that ScratchJr has now been released. I was one of the many people who supported its Kickstarter project with a small donation, and it's lovely to be recognised with a mention in the game credits. You can download it now for free from the Apple App Store. The Android version is in development now and is planned for release later in 2014.
Find out more...
If you're a fan of ScratchJr's older cousin, Scratch, you can also find more information on my other book, and bonus content including demo scripts, at the Scratch Programming in Easy Steps homepage.
If you're new to the iPad and need help with installing apps and common gestures, check out my book iPad for the Older and Wiser.