arrow_back Move Around the Stage
In this video, you will learn how to make sprites move around on the stage.
In Scratch, the stage is a coordinate plane.
You may have learned about coordinate planes before in math class.
The horizontal part of the stage is called the x-axis, and it is numbered from negative 240 to positive 240.
The vertical part of the stage is called the y-axis, and it is numbered from negative 180 to positive 180.
The numbers along the x and y axes of the stage are called “coordinates.”
Every position on the stage has a pair of coordinates that represent where the x and y axes intersect at that point.
To find out the coordinates for a position on the stage, hover the mouse pointer over that spot, and read the x and y values in the lower right corner.
In the example project, the “my sprite” moves to stand next to the best friend sprite.
Your sprites don’t need to move like the ones in the example project.
This is just an example.
Your sprites should move however makes sense in your story.
In Scratch, there are lots of ways to make sprites move!
You could use the “move 10 steps” block, the “go to x and y” block, or the “glide 1 sec to x and y” block or the “change x by 10” and “change y by 10” blocks.
In computer science, there are often many ways to solve the same problem.
You can choose whichever way works best for you and your story!
This example uses the “glide” block.
But you can use any motion blocks that work for your project.
To find out the x and y coordinates that “the me sprite” should go to, drag the "me" sprite to the spot where you want it to end.
The x and y values will update in the “glide to x and y” block.
Drag out the “glide” block, and connect it to the block stack for the sprite.
Click the green flag to test your code.
Wait, that’s not right!
The sprite starts at the new location you just set, rather than returning to its original position.
That’s because you have to program it to go back to the starting point using a “go to” block.
Click and drag the sprite to the location where you want it to be to get the correct coordinates.
Add the “go to” block to the beginning of your block stack, then test the code again.
Great, it works!
Use “wait” blocks to make the program work in sequence.
To continue building your story, add another sprite, and program it to move however you like.
Use “wait,” “hide,” and “show” blocks to make the new sprite appear and move on the stage at the right time.
Now, it’s your turn: Use motion blocks to make a character in your story move.
If you would like, add another sprite, and use motion blocks and “wait,” “hide,” and “show” blocks to make it appear and move on the stage.