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 Viene fuori il sole

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 will 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 this character saying “Me too.” Click looks, drag out a “change backdrop to” block, and place it at the end of your story. Click the dropdown 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 this 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 test 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 a “hide” block. The rain should show at the start of the program, so place the “show” block after the green flag. The sprite should hide when the backdrop changes, so click events, and drag out a “when backdrop changes to” block. Change the dropdown to match the name of your second backdrop.

Test this out. The rain should show at the beginning of the 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! Nice, the lightning only switches between the lightning and 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 dropdown menu to the second scene backdrop. To stop this code from running, click control, and drag out a “stop” block.

Click the dropdown, and select “other scripts in the stage.” 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 change! Now it’s your turn: 1) Select a backdrop for the second scene, and program it to change at the end of your story.

2) 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.

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

Scegli un’estensione
Reazione al fulmine
Con questo componente aggiuntivo, farai reagire i personaggi della tua storia alla caduta del fulmine.
Disegna un fulmine
Con questo componente aggiuntivo, disegnerai un fulmine controllabile dall'utente che si muove dal cielo verso terra.
Viene fuori il sole
Con questo componente, programmerai una seconda scena per la tua storia di una giornata tempestosa.
Fai rimbombare il tuono
Con questo componente, potrai inserire nella storia il rombo del tuono e lo scroscio della pioggia.
Terremoto
Con questo componente, invierai un terremoto per dare una scossa alla storia.
Programma un arcobaleno
Disegna un arcobaleno e fallo comparire nella storia della giornata tempestosa!
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Scegli un componente aggiuntivo e fai clic su "Guarda" per scoprire come costruirlo.
  2. Una volta terminato un componente aggiuntivo, scegline un altro da provare!