arrow_back Dangerous Cave Walls
When the bird runs into the walls of this game, the player loses. In this add-on, you’ll make it so the player sprite explodes when touching the walls of the cave.
One way to make a sprite explode is through costume changes. For example, there is already an explosion costume for the parrot in the starter project you remixed.
This “switch costume to” block switches to a specific costume.
If explosion is not the costume in the “switch costume to” block, click the drop-down menu, and change it to “explosion.”
The parrot should explode if it touches the edges of the cave. Cave edges are colored black, so, the “switch costume to explosion” block belongs inside an “if touching color black” block.
Now, this part of the program reads: Test your code.
Great! The sprite explodes when touching the cave walls. You may want to add a sound that will play when this happens, or use a “repeat” block with a “change size” block to make the sprite get bigger when it explodes. Exploring fun customizations like this is one of the best parts of computer science, and it’s a great way to make your game more interesting and fun to play.