Skip to content
Transcript

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.

Great!

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.

Test again.

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.

Choose an Add-On

Start here
Move Your Hero

Make your hero move up and down when arrow keys are pressed.

Fly Over Buildings

Program buildings to move across the screen, so your hero appears to fly.

Add Background Music

Set the scene for your hero by adding sound to your project.

Show Off with a Super Spin

Help your hero do great things with this spinning move.

Keep Score

Create a game by programming your hero to collect objects.

Support Your Hero

Add another character to help your hero.

Draw Your Own Hero

Use the Paint Editor in Scratch to draw your own hero.

Instructions

Para hacer esta actividad en español, haz clic aquí.

 Students

  1. Watch the introduction video.
  2. Open the starter project link and choose a sprite for your hero.
  3. Return to this page and watch more videos below.

Teachers

  1. Visit the Hour of Code teacher resource page for instructions.