In this video, you'll learn how to use the go to block
and the forever loop,
to make the sprite move continuously across the stage.
Right now, when you click the block stack,
the sprite glides to the center of the stage
and to the right.
You want the sprite to look like it walks off the stage,
then walks back on to it from the left.
To do this, use the go to block from the motion menu.
This block makes the sprite instantly appear,
anywhere on stage.
Drag the sprite to the left of the stage,
where you want it to appear.
This will automatically update the x and y values
in the go to block.
Drag and snap the go to block
onto the top of the block stack.
Then click it to see what happens.
The sprite appears on the left of the screen,
glides to the center of the stage, then glides to the right.
Clicking the block stack multiple times,
makes the sprite seem to move off the right side
of the stage and reappear on the left side.
The go to and glide blocks both have x and y values.
The go to block is the simplest way to move a sprite
to another spot without displaying any animation.
The sprite just appears.
I's used whenever a sprite needs to jump
from one spot to another.
The glide block, on the other hand,
makes the sprite visibly move across the screen
at a speed determined by you.
Right now, your sprite glides across the stage.
To make this happen repeatedly, use a loop.
A loop repeats a set of computer instructions over and over
for a specified number of times, or forever.
A forever block is a type of loop
that repeats the entire time the program is run.
Click on the control menu and drag a forever block
into your code stack, so that it snaps
around your other code blocks.
Now, when you click on block stack, the code blocks
inside the forever loop will continuously run
until you hit the stop sign to stop your program.
Now it's your turn.
Go to the scratch browser tab.
Drag the sprite to the starting position on the stage.
From the motion menu, drag the go to block
to the top of the code stack.
From the control menu, select the forever block
and snap it around your block stack.
After getting your model to continuously walk
across the stage, return to this screen
and click the green next arrow,
to move on to the next video.