Skip to content
Transcript

In this add on you'll program a second scene for your rainy day story.

This will be a particularly challenging add on because you will need to fix a lot of bugs to make this work.

To start give your second scene a backdrop by clicking choose backdrop from library and choosing a scene.

This example we use something sunny, like water and rocks.

Next program the backdrop to change at the end of your first scene.

In this example, the last thing that happens is the character saying, "me too".

Click looks, drag out a change backdrop to block, and place it at the end of your story.

Click the drop down menu and select your second backdrop.

Try it out.

Great! The backdrop changes but as you might have guessed changing the backdrop presents a lot of new problems or bugs.

If you take a look at the story, you'll notice that it's still raining, the earth sprite is still showing, the lightning code for the backdrop is still running, the lightning switches between all three backdrops not just the lightning and night sky.

Successful programmers and computer scientists solve these types of problems every day.

They break down bugs into individual problems and solve them one at a time with creativity and persistence.

Be sure to rest your code every time you come up with a fix to check that you solved the problem.

Next, hide the rain sprite when the backdrop changes.

Click the rain sprite, select the looks menu and drag out a show and hide block.

The rain should show at the start of the program, so place the show block right after the green flag.

Then the sprite should hide when the backdrop changes.

So click events and drag a when backdrop changes to block, change the drop down to the match the name of your second backdrop.

Test this out.

The rain should show at the beginning of your story, and hide when the backdrop changes.

Great! Two problems solved.

You can use the same approach to hide the earth.

Show the earth sprite at the start of the program, and hide the earth sprite when the backdrop changes.

Try it out.

That's three problems solved.

Now tackle the problems with the lightning.

Click the stage, the lightning is switching between all three backdrops because this code uses a next backdrop block.

Replace the next backdrop block with a change backdrop to block and change the name to night sky.

Then add another change backdrop to block and change the name to lightning.

Try it out.

The lightning only switches between the lightning and the night sky.

Four problems solved, you're almost there.

Finally, program the lightning code to stop running when the backdrop changes to your second scene.

Drag out a when backdrop changes block, And change the drop down menu to the second scene backdrop.

To stop this code from running, click control and drag out a stop block.

Click the drop down and select other scripts in this sprite.

This will stop all the code that's running on the stage.

Okay, that was the last problem.

Test your code.

Great! The lightning stops flashing and you've successfully programmed a new backdrop for your story's second scene and solved all of the problems created by the backdrop's change.

Now it's your turn.

Select a backdrop for the second scene and program it to change at the end of your story, fix the problems that came up when you changed the backdrop.

Make the rain stop, hide the earth sprite, fix the bugs in the lightning and make the story switch back to the original backdrop at the beginning.

Use your persistence to solve these problems one at a time.

Choose an Add-On

Lightning Reaction

In this add-on, you’ll program the characters in your story to react when the lightning strikes.

Drawing and Animating a Lightning Bolt

In this add-on, you’ll draw and program a user-controlled lightning bolt that moves from the sky to the ground.

Sun Comes Out

In this add-on, you’ll program a second scene for your rainy day story.

Playing Thunder

In this add-on, you’ll play thunder and rain sounds in your story.

Earthquake

In this add-on, you’ll broadcast an earthquake to really shake up your story.

Code a Rainbow

Draw and program a rainbow to appear in your rainy day story!

Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!