In this video, you'll program the lightening to flash using loops and change backdrop blocks.

So far, you've created code only for a sprite.

In this video you will program the stage.

To start, select the stage.

You can program the stage to do almost everything a sprite can do.

Except move.

Next, look in the backdrops tag.

You'll see that there are two backdrops in the starter project.

One for the night sky, and one that's bright like a lightning flash.

If you click quickly between these two backdrops you can see what the lightning flash is going to look like.

You will program the computer to make that flash happen much faster than you can click.

To start, program the stage to change backdrops.

We'll click looks, and drag out a next backdrop block.

Click the block to test it.

You should see the backdrop change.

Click it again and see that the backdrop switches back to the night sky.

Lightning usually flashes more than once.

Earlier you used a forever block to make something happen over and over.

But this time you only want the lightning to flash a few times.

Not to keep repeating forever like the rain.

So use a repeat ten block to limit the number of times the lightning repeats.

Click it to try it out.

Great, the backdrop changed, and the lightning flashed ten times.

Tinker with this number until you like how many times the lightning flashes.

Now you might notice that enter an odd number into the repeat block, the lightning continues to show after the final flash.

If this happens, click the next backdrop button again (pause)

change the value in the repeat block to an even number.

This example will repeat four times.

If the lightning is flashing too fast, consider adding a wait block inside your loop and changing its value to a really small number.

Like 0.1 or 0.01.

This will make the computer wait between switching backdrops so the lightning flashes more slowly.

Great, now that the lightning flash is programmed, you need to tell the computer when to flash the lightning.

Add a when flag clicked event, to the top of this block stack.

Try it out by clicking the flag.

Great, the lightning flash is the beginning of the story.

There's just one problem if you click the stop button when the lightning flashes, then the program will start with a yellow backdrop.

To fix that bug, add a switch backdrop to night sky block under the when flag clicked block.

Great, now whenever the program runs it will start on the night sky backdrop.

In the next video you will program the lightning to flash randomly throughout your story.

Now it's your turn.

Select the stage.

Program the backdrop to change with a next backdrop block.

Use a repeat block to make the backdrop change a specific number of times.

Start the program with a when flag clicked event.

And then add a switch backdrop block.


  1. Program the backdrop to change.
  2. Make the backdrop change a specific number of times.
  3. Wait between backdrop changes.
  4. Start the program when the flag is clicked.

Hint: If the backdrop stops on "Lightning Flash", click the "next backdrop" block, or select "Night Sky" from the backdrops tab.