Now that you've added some foreshadowing to your story, you will program a glitch that you can reuse throughout the story.
Then you will make your second character react to the glitch.
In this signal, Gumball is the first to experience the glitches and he struggles to explain them to Darwin.
Check out some examples.
What do ya think?
Nah I think it's a bit, You're right, too desperate for attention.
Oh, how about this?
Yeah that one makes you look kinda, Yeah, I get it.
Too thinking it's cool but lonely at school.
What just happened?
How about this?
Yeah, that one makes you look, Yeah, too Canadian.
I really like this one but do you think it makes me look like I have a fat head?
I, uh, To make a glitch for your character, you will write code that changes their appearance.
From the looks menu, drag out a change effect by block.
Click it to see what it does.
It changes the color value of the sprite by 25.
Click the dropdown and select a few different effects to try.
There are may ways to change your sprite's appearance.
Click the clear graphic effects block to return your character back to normal.
Running the block once creates a small effect.
To make the effect even more dramatic, run it repeatedly.
This is called a loop.
Click control and drag a repeat 10 block around the change effect by block.
Select an effect to repeat and click the block to try it.
Play around with the values to see the different effects you can create.
To reset each time, add the clear graphic effects block to the bottom of the stack.
Combine effects and repeat blocks to make as dramatic of an effect as you would like for your story.
Once you have an effect you like, add it to your block stack and try it out.
Once you create a glitch, make the second character respond to it.
Select the second character.
Drag out a save for two seconds block and type in what the character will say about the glitch.
These are just examples of what the secondary character might say when it sees the glitch happening.
Add a response that fits your story.
Click the block to run it.
Great, the character responds.
Right now your code stacks run like two separate programs.
To tell a story you click one stack then switch characters and click the other but there's a better way.
Use the flag to run both block stacks.
Select the event menu.
An event tells the code when to run.
There are many different types of events.
Click and drag out a when flag clicked block for both sprites.
This block will start the code when the flag is clicked.
Click the flag to try it out.
Both stacks run at the same time but the second character responds too quickly.
To fix this, add a wait block, between the show and say blocks.
Take a width of the time until the second character's response to the glitch seems much more natural.
Click the flag to try it out.
To build out more conversation in this scene, use wait and say blocks.
As computer scientists develop programs, they test their code often as they build it.
Then they make improvements based on what they see in the test.
They also share what they've made with others so take time now to click the share button.
Now it's your turn.
Program a glitch using repeat and change effect by blocks, reset the glitch using a clear graphic effects block, add dialogue using say for two seconds blocks and wait blocks, run both characters' code using when flag clicked blocks, and finally, click the share button so everyone in the coding community can view your project.
- Program a "glitch" using "repeat" and "change effect by" blocks.
- Reset the "glitch" using a "clear graphic effects" block.
- Add dialogue using "say for 2 seconds" blocks and "wait" blocks.
- Run both characters' code using "when flag clicked" blocks.