Students learn how to use motion blocks to make their sprites move and turn on the screen.
Imagine you are a video game designer. How do you tell a robot hero exactly where to walk so it doesn't fall into a pit of lava? It all starts with the power of Motion blocks!
In coding, we move sprites using steps. Think of a step as a tiny unit of distance on your screen. To move forward, we use a positive number like . To move backward, we use a negative number like . When you click a move block, the sprite travels in the direction it is currently facing. If you want your sprite to go faster or further, you simply increase the number of steps in the block!
Let's make a sprite walk forward and then back to where it started. 1. Drag a 'move 10 steps' block onto your workspace. 2. Click it 5 times. Your sprite moves steps forward. 3. Change the number to and click it once. Your sprite is back at the start!
Quick Check
If your sprite is at the center and you use a 'move -20 steps' block, which way does it go?
Answer
It moves backward (the opposite direction it is facing).
To change which way a sprite is looking, we use degrees. Imagine standing in the middle of a giant clock. A full circle is . If you want to make a sharp 'square' turn, you use . Turning clockwise moves the sprite to the right, while counter-clockwise moves it to the left. By combining moves and turns, you can make your sprite dance, spin, or walk in shapes!
To make a sprite face exactly the opposite way, follow these steps: 1. Use a 'turn clockwise' block. 2. Set the degrees to (because is half of ). 3. Click the block. Your sprite has pulled a 'U-turn'!
Quick Check
How many degrees would you need to turn to make a complete, full circle spin?
Answer
360 degrees.
The stage is actually a hidden grid! We track every spot using two numbers: X and Y. The X-coordinate measures left and right. Moving right increases , and moving left decreases it. The Y-coordinate measures up and down. Moving up increases , and moving down decreases it. The very center of the stage is where and . This is called the origin.
Let's code a sprite to draw a square using coordinates and turns: 1. Start at . 2. Move steps forward. 3. Turn clockwise . 4. Repeat these two steps 4 times. You have just used geometry to code a shape!
If you want your sprite to move UP the screen, which coordinate should you increase?
How many 90-degree turns does it take to turn all the way around back to the start?
Moving -50 steps is the same as moving 50 steps backward.
Review Tomorrow
Tomorrow, try to remember: What are the two letters used for the stage grid, and which one goes up and down?
Practice Activity
Open your coding editor and try to make your sprite walk in the shape of a triangle. Hint: You will need to turn more than !