Your browser version is not supported by this site. CS First may not work properly. Learn more.
3. The Glitch and a Response
Now that you've added some foreshadowingto your story, you will program a glitchthat you can reuse throughout the story.
Then you will make your second characterreact to the glitch.
In this signal, Gumball is the first to experiencethe 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 makesme 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 dropdownand select a few different effects to try.
There are may ways to change your sprite's appearance.
Click the clear graphic effects blockto 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 blockaround the change effect by block.
Select an effect to repeat and click the block to try it.
Play around with the values to seethe different effects you can create.
To reset each time, add the clear graphic effectsblock to the bottom of the stack.
Combine effects and repeat blocksto make as dramatic of an effectas 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, makethe second character respond to it.
Select the second character.
Drag out a save for two seconds blockand type in what the character will say about the glitch.
These are just examples of whatthe secondary character might saywhen 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 stackthen switch characters and click the otherbut 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 blockfor 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 timebut 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'sresponse 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 basedon what they see in the test.
They also share what they've made with othersso 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 twoseconds blocks and wait blocks,run both characters' code using when flag clicked blocks,and finally, click the share buttonso 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.