Moving a sprite in scratch

Updated: February 17, 2022
No Credit Card Required


Welcome back. Hey, do you remember my name? No. Sad face. It's Christy. Are you ready to get started? Let's code.

There are two ways to move your sprite. Last lesson, we use the MOVE STEPS COMMAND to indicate the number of steps you want the sprite to take. To go backwards while still facing the same direction, we used a negative number of steps.

The second way to move your sprite is the go to X AND Y COMMAND. This moves your sprite in a specific position on the screen. We tell Scratch the position we want using a GRID, which is a map on the screen. Here's an example of the XY GRID. The X is the line across the screen from left to right. This is called the horizontal axis. Axis just means a line and horizontal just means a line that runs up and down the screen or in a vertical direction.

We use the numbers on these lines to tell the program where we want the sprite to move on the screen. These numbers are called COORDINATES. The position of our sprite on the screen is communicated to the computer using COORDINATES. The line that tells Scratch the position across the screen is the X COORDINATE and the other designates the position on the up down or Y AXIS.

The COORDINATES are like the address except in programming, we call this THE POSITION. Where the X AXIS and Y AXIS lines cross is called? Can you guess it? The CENTER. The CENTER is defined as POSITION 00. So if your sprite has a position of 00, you know you're always in the center of the screen.

As our sprite moves on the screen, the COORDINATES change to help us know that the POSITION of the sprite has changed. As we move to the left, X gets smaller, we move to the right, X gets larger. If we move down, Y gets smaller, and we move up Y gets larger.

All right, let's play a quick game. Where would the sprite be if it's at Position X0 and Y0? Or (0,0). That's right. It's in the CENTER of the GRID. What direction would the sprite move if it moves from the CENTER to position (0,10)?. That's right, it moved to the up on the GRID.

You can move your sprite using the GO TO X & Y COMMAND BY setTING the position you want as the coordinates on the grid. Pretty easy now that you understand coordinates and grids.

Alright, I'll meet you again. In the next lesson. We'll work on DIRECTION & ROTATION. Bye bye for now.