Olympic Gold – Part 1

To celebrate the 2016 Rio Olympics, I wanted to create a ‘3D’ running game, using a MakeyMakey running mat as input. In the first of 2 posts, I outline the process of creating the game. (See part 2 for how to create the running mat.)

Sprinting in 2D

Initially I created something very simple, with the Scratch cat moving towards a finish line when the left and right arrow keys are alternately pressed.

Here’s what the project looks like (click the image below to play):


The code needed to create this game is very simple. A sprite just moves (and changes costume) whenever the left and right arrow keys are pressed, until the finish line is reached.


However, there’s a problem when playing the game – simply holding down the left and right arrow keys causes the Scratch cat to sprint towards the finish line in record time! To fix this, I decided to add in blocks to wait until each key is not pressed after it has been pressed. This means that each key has to be pressed and released in turn for the cat to move.


Sprinting in ‘3D’

After children have grasped the basics of Scratch, one thing I’m often asked is whether it’s possible to make 3D games in Scratch. Although not easy, the answer is that it’s definitely possible.

What they often want is for characters to move towards them, instead of left-to-right across the stage. This can be achieved by creating a stage background with a 3D perspective, like this:


The code can then be adapted to enlarge and move the finish line as the left and right arrow keys are pressed (and released):


Notice how it’s now the finish line that’s moving, so I’ve created a ‘distance’ variable, so that the game knows when the race is over.

Here’s the finished ‘Olympic Gold’ project (click the image below to play):

Screen Shot 2016-07-01 at 13.09.25.png

Hall of Fame

The game includes a high score table (created as a list) to keep track of the fastest sprinters. At the end of each game, a check is made to see whether the player’s time is faster than the slowest time in the list (the last item).


If the player has sprinted fast enough to make the high score table, a custom Scratch block inserts the player’s score at the correct position in the list.


Creating a ‘3D’ Sprint Game

A simplified version of this game is available available to registered clubs as a new ‘Sprint!’ Scratch project, along with 3 other Olympics-themed projects.


One thought on “Olympic Gold – Part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s