Hacking Scratch Games: A CoderDojo Tutorial

Eileen King
Apr 2, 2016 · 5 min read

This tutorial is written for the Northfield chapter of CoderDojo for our special “April Fools Hacker” theme. It is aimed at students ages 8 and up.

Let’s say you’re playing this Scratch version of Flappy Bird, and it is frustrating. You’ve been at it for hours, and you want a medal! If only you could break the game open and make it a little bit easier…

Getting Started

Fortunately, Scratch pretty much invites you to poke around inside projects — you just click the big blue “See Inside” button!

Ready to break things? Click “See Inside”

When you click that, you’ll be able to see all of the sprites, costumes, backgrounds, and scripts for the project. If the game is complicated, it might be a little bit overwhelming: there are probably a LOT of scripts, and sprites you wouldn’t have expected. Take a deep breath, and don’t panic!

There’s a lot going on here — don’t let it scare you!

When you’re ready to start messing around, click the orange button that says “Remix.” This makes your own copy of the project — you can move or change anything you like, but it won’t affect the creator’s project, just your copy.

Now I have my own copy — its title is Flappy Bird remix, and it says my username below the title.

Starting to Break Things!

Now comes the fun part: start to take it apart! You could, of course, just go crazy: pull out a random chunk, click the green flag, and see how it breaks. Or you can look at the code carefully, guess what will happen if you change something, and test your ideas.

Either way, it’s probably smart to just separate blocks rather than deleting them (check out the picture below if that doesn’t make sense).

Blocks that aren’t attached to an Event block won’t run anymore, so you’ll get to see what would happen if they were deleted. But if you want them back later, it’s much easier to just reattach them than to try to rebuild a deleted script!

See how this script is broken apart? It won’t run anymore, but it can be reattached later!

If you’re going to start breaking carefully, pick a script, read it, and try to guess what would happen if you changed it! Then click the green flag, and test your hypothesis.

Making it Harder to Lose

Here’s an example idea: one of the Bird sprite’s first scripts tells it when to send a “Game Over” message.

What would happen if you took out one of the blocks inside the “wait until”? (Pull one out, click the green flag, and see for yourself!)

Making the Pipes Easier

Maybe you don’t want to totally cheat, you just want the game to be a little easier. What if the gaps between the pipes were wider?

Click on the Pipe sprite, then on its costumes tab.

Here are the pipe’s costumes. Each time a new pipe appears, it picks a random costume!

Now, grab the select tool, and use it to make a rectangle around part of the pipe.

If you’re confused, just ask! And remember that the undo button is a good friend.

Now that you’ve selected a piece with a pipe in it, use the mouse or arrow keys to move it up or down!

Before and after: making more space between the pipes will make the game much easier!

Repeat those steps with the pipe’s other costumes, then click the green flag to test the game with your new pipes. What do you think?

Getting Medals Sooner

One last idea: let’s say you think 40 points for the platinum medal is too many, and you want to make it easier. First, you’ll need to find the code that makes that happen. Scroll in the sprite list until you find the Scoreboard sprite, and click on its Scripts tab.

Here is the Scoreboard’s code!

Do you see how the script says to wait until the user’s score is 10, then switch its costume to a bronze medal, then wait until the user’s score is 20, then switch to a silver medal, and so on? Well, this is your version of the game — change those numbers to anything you like! If you want to get a bronze medal for just one point, and a silver medal for two points, you can do that! Just put different numbers inside the green blocks.

You could even take it one step further: why are there only four medals? To make a new medal, you’d just need to make a new costume for the scoreboard, then add on to this script to tell the game when to give the user the new medal.

Other ideas

Those are just a few examples of hacks you could make to this game. The sky is the limit: you could change the bird sprite so it’s a flying fish instead! You could switch up the sound effects! You could even be really sneaky and switch up the buttons so that the user actually has to click score to start the game…

One final note: the person who programmed this game did a good job picking smart names for variables, sprites, costumes, and broadcasts — that makes it possible for you to read and edit the code! Keep that in mind as you work on your own projects: the way you name things has a huge impact on how easy it is to read your scripts. That doesn’t just make it easier for remixing hackers — it also makes it easier for YOU to come back to a project later and remember how it works, and it makes it easier for other people to work with you!

Other games to hack

You can, of course, pick any Scratch project and take it apart like this. If you need some suggestions, here are a few:
- Shark Attack
- Snake (made by CoderDojo member Connor!)
- Evasion
- Hungry Bat (requires a microphone)

Eileen King

Written by

Minnesota educator primarily using Medium as a publishing platform for coding tutorials | nfldcoderdojo.org | #cs4all | #mncodes

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade