Watch the video.

Responsive image

Ingredients

You will need:

  • A player sprite. In these examples, I've used the Scratch cat sprite that you get when you start a new project. Obviously you will want one that suits your game idea. Either pick one from the built in sprites or draw one of your own.
  • Two variables for 'this sprite only': one called 'gravity', the other called 'speed'.
  • A stage backdrop for the first level. Click the stage design icon, on the left of the Sprites area and use the drawing tools to make a level using different colours. Keep to just a few colours to start with.
Responsive image

Download the booklet

 

Method

 
Responsive image

Set the player's starting position

  1. Drag the sprite to the position on the stage where you want it to start.
  2. From the 'Motion' blocks, drag the go to x: y: block into the sprite's scripts. It will have the x: and y: position automatically set to the position you just placed the sprite.
 
 

Activate gravity

Create a forever loop for the player sprite. This is the main game loop for the sprite and it will get quite big! As it does so, just remember that it is made up of groups of blocks that do different jobs.

Responsive image

 

Responsive image

Before adding to the game loop.

Stop falling at the ground

Responsive image

Sprites can detect when they are touching a colour in the backdrop. We use this sensing technique to make the player sprite interact with the level being played.

Responsive image

After adding the colour test blocks to the game loop. You can see it starting to grow.

 

Move right with the arrow key

Responsive image

With gravity sorted, it is time to give the player some speed in the horizontal directions (left and right). Add the blocks shown to the game loop above the gravity blocks and your sprite will move across the screen when you press the right arrow key.

Give your sprite a sequence of costumes to make it look like it is walking, running, slithering or whatever your player does to go places!

 
 

Extend it

Can you:

  • Make the player go left as well as right
  • Stop falling on more than one ground colour (the orange in the example)?

Hint

Responsive image

Norton Community Primary School · Grove Street · Norton-on-Derwent · Malton · North Yorkshire · YO17 9BG · (01653) 692104 · email: admin@norton-pri.n-yorks.sch.uk

Please ask for Mrs Pauline Calvert.