The ability to fly is a very popular hero power.
In this video, you will program your hero to fly across the stage.
In Scratch, there are many ways to move a sprite.
One way to make your hero look like they are flying is to move the building sprite across the stage.
To begin, select the building sprite.
Move the building sprite to where you want it to start on the stage.
From the Motion menu, drag out a “go to x y” block.
This block makes the sprite appear in a specific location on the stage.
Notice that the number in the block is automatically updated to the building sprite’s location.
Next, you’ll program your building sprite to move across the stage.
From the Motion menu, drag out a “change x by” block.
Do not connect the blocks yet.
Change the value to a negative number.
Click the block to test it.
Great! Your building moves to the left.
Your building moves once, but you want it to move across the stage.
To make it move over and over,
drag out a “repeat” block from the control menu and place it around the “change x by” block.
Change the values so that the building moves off the stage.
Click your block stack to test.
Now your building moves across the stage.
Next, program the building to move across the stage over and over again.
Attach the “go to x y” block to the top of the repeat loop
and add a “forever” loop from the control menu.
Change buildings by dragging out a “next costume” block
and placing it inside the forever loop above the “go to xy” block.
The costume changes will make it look like your hero is flying over different buildings.
Then, click the events menu and add a “when flag clicked” event to the top of your block stack.
The hero flies over the buildings. You got it!
Once you’ve programmed your hero to fly over buildings,
consider adding more movement with “Move Your Hero."
Then, come back to this page to check out more videos! You can try any video you like.
Make your hero move up and down when arrow keys are pressed.
Program buildings to move across the screen, so your hero appears to fly.
Set the scene for your hero by adding sound to your project.
Help your hero do great things with this spinning move.
Create a game by programming your hero to collect objects.
Add another character to help your hero.
Use the Paint Editor in Scratch to draw your own hero.
Para hacer esta actividad en español, haz clic aquí.
Sign in to save your project and track your progress.