We are going to learn how to change the numbers in our blocks to alter the way our sprite moves. We will also learn how to animate our sprite to make it look like it is running! We will be using the same categories that we have covered previously: events, motion and control. We will also use the looks category.

Step 1. Setting up our scene!

Delete your cat sprite from the sprites pane.

Hint: right click on your sprite in the sprites pane!

Click the sprite button (above) in the sprites pane.

Add a sprite from the Walking theme.

Click the picture button (above) in the sprites pane to add a backdrop.

Hint: Use the track backdrop if you want to make your sprite race!

Drag your sprite to where you want it to be on your stage.

Step 2. Get your sprite moving and talking!

Add this script to your sprite:

Click on the looks category in the block palette.

Now add the say Hello! for 2 secs block.

Double click where it says “Hello!” so that we can write something inside this block!

Inside the say  block, type: “Look how fast I can run!”

This block will tell our sprite what to say for a specified amount of time. Here, it is set for 2 seconds:

Test your code. What happens?

  • How can we make our sprite go faster and further?

The number in the move 10 steps  block says how far the sprite will move. The further it moves each time, the faster the sprite moves!

The repeat 10  block is a loop.

It is like a forever  block, but it will repeat as many times as we tell it to!

The number in the repeat  block is telling us how many times the sprite will move.

Our script is telling the sprite to move 10 steps 10 times.

  • How many steps do you think the sprite will take in total?

Hint: 10 x 10 = ?

Change the numbers in the repeat  and move  blocks. Use any numbers you like!

  • Can you make your sprite move slowly across the entire stage?

Step 3. Animating our sprite!

Add the next costume  block from the looks category.

This block tells your sprite to change to the next costume.Your sprite will change costume every time it moves to make it look like it is walking.

Click the costumes tab (above) above the script area.

You will see all of the costumes your sprite is changing between!

Test your code. What happens?

Step 4. Challenges!

You have animated your sprite to run across the screen!

We have learned how changing the numbers in our blocks can change how our sprite moves and looks.

Ready for some challenges?

  • Add another sprite to race with!

  • Change direction and walk back

  • Make your sprite follow the mouse pointer!

  • Only move the sprite when it is clicked

Did this answer your question?