3. Die Figur wieder auf der Bühne erscheinen lassen
In this video, you'll learn how to use the "go to" block and the "forever” loop tomake the sprite move continuously across the stage.
Right now, when you click the block stack, the sprite glides to the center of the stageand to the right. You want the sprite to look like it walks off the stage, then walks backonto it from the left. To do this, use the "go to" block from the motion menu. This blockmakes the sprite instantly appear anywhere on stage. Drag the sprite to the left of thestage, where you want it to appear. This will automatically update the x and y values inthe "go to" block. Drag and snap the "go to" block onto the top of the block stack, thenclick it to see what happens. The sprite appears on the left of the screen, glides to the centerof the stage, then glides to the right. Clicking the block stack multiple times makes the spriteseem to move off the right side of the stage, then reappear on the left side.
The “go to” and the “glide” block 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! It’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 screenat 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 instructionsover 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 snapsaround your other code blocks. Now, when you click on the block stack, thecode blocks inside the forever loop will continuously run, until you click the stop sign to stopyour program. Now, it's your turn:Go to your Scratch browser tab. Drag the sprite to a starting position onthe 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 andclick the green Next arrow to move on to the next video.