Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Lightning Reaction

Transcript

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

First, click on the stage.

When the lightning strikes, you’ll need to “broadcast” a message to the other sprites that it’s time to react. To do this, select the events menu, and add a “broadcast” block after the “wait” block. Change the name of the message to something like “Lightning.”

Now, when the lightning strikes, the “lightning” message will be broadcast to the rest of the program. Next, program the sprite to respond to that lightning strike message.

Click the character that you want to respond, then drag out a “when I receive lightning” block. Any code you add to this event will only run when the lightning message is broadcast.

To test this, add a “say for 2 seconds” block to the code, and run it.

Great. Now when the lightning strikes, the sprite says “Ah!”

The broadcast “lightning” block triggers the code under the “when I receive block” Now it’s up to you to create other ways for your sprite to react to lightning strikes.

The reaction should go with your character’s personality. Is it scared? Evil? Brave? Silly?

Think about how the character in your story would react when lightning strikes.

Now, it’s your turn! 1) Select the stage, and add a “broadcast” block after the “wait” block. 2) Rename the message, “lightning.”

3) Use a “when I receive lightning” event to start your character’s reaction.

4) Program the reaction.

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!
arrow_backward Back
Next arrow_forward
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!