(cheery pop melody)
In the Gumball episode, "The Signal"
a glitch affects the sprite and background
simultaneously as if the broadcast signal is distorted.
Check out what this looks like.
(glitchy audio effects)
Oh my gosh, you were right! Something weird is going on.
In this video, you will create a similar effect
by making the glitch affect your backdrop.
To do this, you will copy the glitch code to the stage.
Select the sprite that experiences the glitch.
In this example, that's Molly.
Drag the "define Glitch" block stack onto the stage.
Select the stage.
The code you copy appears in the script editor.
Click the code to test.
Great! The backdrop pixelates just like the sprite.
Click the flag to test the backdrop
glitch with the rest of the program.
Oh no! The glitch affects Molly
but it does not affect the backdrop.
Fix this by using "broadcast" to send a message
telling the backdrop to run this glitch code.
The broadcast block sends a message
from one sprite to another.
The receiving sprite runs its code
as soon as it receives that message.
To start, choose which sprite in your program
will send the message and which will receive it.
In this example, Molly sends the broadcast message.
Click the sprite that will send the message in your project.
Then, drag a broadcast block from the
"Events" menu into the script editor.
Create a new message and rename it.
This example names the message "Start Glitch."
To make the sprite broadcast the message before
it pixelates, add the broadcast block
under the "define Glitch" block.
Next, program the backdrop to receive the braodcast message.
Click the backdrop sprite. Separate the code
you will reuse from the "define Glitch" block.
Then, drag the "when I receive" block
from the "Events" menu to the top of the block stack.
Select your message. Click the code to test it.
The backdrop glitches.
Finally, click the flag to test the animation.
Both the backdrop and Molly glitch at the same time.
Great work! Now it's your turn.