How to create a simple game on scratch.

Firstly, open up the program by clicking on the

icon.

A blank page should open up:

To create a background. To edit the background you need to firstly select the box labelled ‘Stage’ and then click the tab labelled ‘Backgrounds’.

Now select the paint option, which will open up a paint area.

In here, fill the background with a colour of their choice using the fill tool. Once this is filled, add a wavy line from the bottom left corner to the top right corner using the paintbrush and a large brush size.

Finally, add another, different colour in the top right corner as the finish line. Then click OK. This should now be set as your background.

To choose a sprite. Once you have edited your back ground, now choose a sprite. The sprite is the character you will be controlling. There are three options for this, draw your own, choose a sprite from the file or choose a random sprite (I would suggest to choose one from file for the sake of time).

To choose a sprite from file, select the icon and a window will open. Explore the different files to find a suitable sprite.

Then click OK. Once selected, this sprite will appear next to the original sprite. We only need one sprite for this game so delete one of them by either right clicking then selecting ‘delete’ or click on the scissors and then the sprite icon at the bottom.

Once the sprite is selected we will need to shrink the sprite so it fits inside the line we have drawn on the back ground by clicking in the shrink icon and then continually clicking on the sprite on the screen.

It is very important that the sprite fits inside the line and none of it is outside and place it in the bottom left corner of the page.

To control your sprite. Finally, you will need to add ‘Script’ to control the sprite and make the game. To do this, ensure that the sprite is selected (it should have a blue box around it) as is the script tab (it should have a light blue background).

On the left hand side you will notice lots of different instructions, and above are 8 different tabs. To start with we are going to select the

tab.

This will bring a different list of instructions up on the left hand side. From this list you will need to add to the script. To do this, click on the icon and drag it across to the blank space under the ‘Scripts’ tab.

This will enable all the rest of the script to start, or reset, once the green flag is clicked.

Once you have established how to start the game, you will now need to make the sprite start in the same position each time. This should be the bottom left of the screen (where you should have already placed the sprite). This will give you a co-ordinate as to its position. Now select the

tab.

As, no matter where it is, we want the sprite to start here every time the game is played we can add a instruction in motion. This should contain the co-ordinate already pointed out (as long as the sprite was already moved to its starting position). Add this underneath the ‘When clicked’ you have already added. Make sure they are attached.

We now need to add script to make the sprite move under our control. We want to control the sprite by using the arrows on the keyboard. To make sure it moves every time we press the arrow we need to add a control of ‘Forever’.

To do this we need to select again and add sure it attaches to the last instruction added.

, again making

Within ‘forever’ we need add an . (We need to make sure that the correct ‘if’ is selected, don’t select ‘forever if’). Now there needs to be something to enable the sprite to follow the instruction we are going to give it, by sensing something has changed. Therefore we need to select the tab. This should give you a list of instructions inside a hexagonal shape. We want to control the sprite by clicking on one of the keys on the keyboard, therefore we need to add . To do this you will need to click on it and drop it in the hexagonal shape next to ‘if’.

We now need to change the key pressed to read up, down, left or right. To do this click on the drop down arrow next to space and select one of them.

Now we need to add the motion of the sprite so we need to reselect . We only want it to move a small amount each time we press the key so we can add in the gap. Make sure that, when dropping the instruction, the white line guides you to the correct place.

And change the 10 to 1. We also need to add a direction in which to point. This will relate to the direction of the arrow you are pressing. Under the add the instruction You will need to click on the drop down arrow and select the direction matching the key e.g. up arrow – (0) up

We need to repeat the same script for the other three keys. Right click on the ‘if’ instruction then select ‘duplicate’.

This will give you exactly the same script. Do this three times in total so as you have four of the same. Now change the ‘key pressed’ to the three keys you have not selected yet (down, left, right), as well as the ‘point in direction’, making sure they match the key you have selected.

Now try out the movement of your sprite by clicking on the green arrow and using the arrow keys to move it around the screen. If it does not move in all directions, re check all the instructions are correct.

To make it into a simple maze game we need to add another ‘if’ from the tab under the final ‘if’ added. We want to make it so that the sprite cannot leave the path; if it does it goes back to the beginning. To achieve this we need it to sense the colour it can’t touch (the main background colour). Click the

tab and insert

Here click on the default colour, which will bring up a small pipette, and click it on the back groud colour. This should change the colour in the box. Re click on the tab and put ordinates are the same as your starting position.

, checking that the co-

Your final script for your sprite should look similar to:

This should give you a basic maze game. Test your game to make sure you can control the sprite correctly and that it will go back to the beginning if you go off the path. It is also important that it is possible to complete the game and reach the end of the path.

Extension To make sure children know they have won the game when they reach the end you will need to add another ‘if’ under the last one you did. To achieve this we need it to sense the colour it must touch to end the game (the colour of the finish line). Click the

tab and insert

Here click on the default colour, as before, which will bring up a small pipette, and click it on the finish line colour. This should change the colour in the box. Click on the instruction.

tab. Now select

and put inside the ‘if’

To choose a sound we need to import one. To do this click on the sound tab in the script area, followed by import and it will open files with pre recorded sounds. Ask children to select one of these sounds in the files and click OK.

Once the sound is selected it will appear in the sound area. You must select a sound first otherwise it will not allow you to add it to your script.

Now click back on the ‘scripts’ tab and then on the drop down arrow on . There should now be an option to select the sound you chose. This sound will now play when the game is completed. To make sure that the sound plays properly you will need to add sprite goes back to the start. Your final script sould look like this:

Now play the game to check everything works.

after it so the

What to do if it doesn’t work?

If the sprite is not moving in the direction you are pressing the arrow then the direction does not match the arrow you are wanting to press. Click on the drop down arrow on with the arrow key selected.

and check that the directions match up

If the sprite keeps going back to the beginning without moving far it will probably be because it keeps touching the background colour. The size of the sprite will have to be changed.

If the sprite doesn’t set off at any point it will probably be because the sprite is starting on the background colour. You will need to either move the sprite, changing the co-ordinates of your start positions, or by shrinking the sprite so it no longer touches.

If the sprite does not go back to the start position it will be because your coordinates don’t match the start position.

If nothing seems to happen at all it may be because your instructions aren’t quite in the right place, or you have missed parts out in the script. Go back and check the positioning of each of the instructions, making sure they are all inside the ‘Forever’ control.

If there is no sound to select on the drop down arrow, it will be because you have not selected a sound from the file in the sound tab.

If the sound sounds like it is stuck it will be because the sprite is continually touching the colour. You will need to make sure you add the end of the script to move it away from the colour.

to