In this add-on, you will program your character to escape the scene! This example uses the “Sprite vs Nature” project, but this add-on works with any of the starter projects. Be creative!
At the beginning of the program, the creature says “It’s cold” and doesn’t know if it will survive the winter. To code an escape vehicle, click on the creature sprite, then click on costumes tab.
Click on the sprite’s costume that you will use, then right click on it to duplicate it.
Great. Next, add an escape sprite. Click the “Add” button on the paint editor to show the different sprites available to choose from. This example adds the green convertible from the Transportation menu, but pick a sprite you like and that works for your story. Consider using sprites like a horse, a giant butterfly, or even a helicopter.
Click on your newly added sprite, and adjust the size so that it looks like the creature fits nicely inside it. Great. Next, program the escape sprite to show up on the stage to help your character get away. Add the same vehicle as a new sprite, and adjust the size. Program the sprite to hide at the beginning of the program, then zoom on stage at the right time. Drag the escape sprite to where it will start on the screen, then add a “go to” block to the scripts editor. Then, drag the escape sprite to the front of the creature on the stage, and add a “glide” block. Test this.
A big part of computer science is persisting through tough problems. If the first solution you try doesn’t work, try again.
The sprite starts on the far left of the stage, then glides to the creature sprite. Awesome.
To hide the escape sprite at the start of the program, add a “when flag clicked” event and a “hide” block. Then, program it to appear using a “show” block after the “go to” block. To tell the sprite to appear on stage at the right time, click on your character sprite, and add a “broadcast and wait” block.
Using the “broadcast and wait” block allows the code for the escape sprite to complete before the character sprite performs its next action. Name the message something that makes sense for the action. This example names the message “escape.” Then, click back to the escape sprite, add a “when I receive” block, and change the dropdown message to “escape.” Awesome. Test this. The character sprite should start on the costume without the escape sprite, then change to the one with the escape sprite and glide away with it. Drag out a “when flag clicked” event, then add a “switch costume” block, and change the dropdown to the appropriate starting costume.
Great. Then, drag the character to where the escape sprite starts, and add a “go to” block under the “switch costume” block. Awesome. Finally, code the sprite to escape the scene.
After the character broadcasts for the escape sprite to arrive on stage, make it glide away using the “switch costume” block. Change the costume to the one with the creature and the escape sprite.
Then, drag the creature and the escape sprite costume to the right of the stage, so it glides off the screen to escape. Add a “glide” block after the “switch costume” block. Test this.
Great! To make the escape sprite hide after it appears on the stage, add a “hide” block under its “glide” block.
Nice job! Consider adding a few “say” blocks to your story to tell the audience where your sprite is going when it escapes!
Now, it’s your turn.
Add a way for your sprite to escape by duplicating your character’s costume and adding an escape vehicle, animal, or object costume. Then, add the same escape sprite as a sprite to your costume. Program the escape sprite to appear on stage using the “go to,” “glide,” “show,” “hide,” and “when I receive” blocks.
Program your character to tell the escape sprite when to appear using “broadcast” and “when I receive” blocks. Finally, program the character to escape using the “switch costume,” “go to,” “glide,” and “when I receive” blocks.