Skip to content

Scratch Coding Lesson 9 - Move Your Sprites

Why
You are going to want action, movement in your projects and games.
What
In this lesson you are going to learn how to move a sprite.
How
Let’s start by opening the move-the-cat project from previous lessons.

If you have multiple sprites in your project, you want to make sure you have selected the sprite you want to add code blocks to. If you have more than one sprite, a little faded picture of the selected sprite appears in the top right of the code area to remind you which sprite you are adding code blocks to.

To move a sprite, you need blocks from the Motion category. Notice some of the blocks have the letters x and y in them with some numbers in little white circles. The stage is actually this invisible grid. Some of you might have even heard of the term coordinate plane in your math class.

The x number controls the position or movement of a sprite from right to left on the stage. The y number controls the position or movement of a sprite from down to up on the stage.

If you were to move your sprite to an x value of zero and a y value of zero, it would position the sprite at the center of the stage.

If you click and drag a sprite to a different position on the stage, notice that the x and y values in some of the code blocks update to show you the current position of the spite.  You can use this as a shortcut if you have not learned about coordinate planes yet.

The challenge for this lesson is to move your sprite to the center of the stage after the green flag block is clicked.

Hint:  pay attention to the x and y values when you manually move the sprite. Take a guess at what the values for x and y are when you are exactly in the center of the stage.

In this lesson you learned how to move sprites on the stage.

Ask Your Question

Do you need help or have a question?