Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

5. Reuse the Glitch

  • 1. Introduction
  • 2. Foreshadow the Glitch with Dialogue
  • 3. The Glitch and a Response
  • 4. Create a New Scene
  • 5. Reuse the Glitch
  • 6. Conclude the Story
  • 7. Wrap-up: The Amazing World of Gumball
  • 8. Wrap-up: Share Your Project
  • 9. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

Now that you have set up a second scene, use it to continue your story.

In this video, you will create dialogue between the main character and the new character you added in the last video.

You will also bring back your glitch.

To start, add some dialogue for both characters.

In this example, Banana Joe acts surprised to see Molly appear.

How would the characters in your story respond if someone unexpectedly appeared?

Start your main character’s dialogue in this scene with a “When backdrop switches to” block.

Make sure the backdrop is the second backdrop for your story.

Use “wait” and “say for 2 seconds” blocks to sequence dialogue between the characters.

After you build out dialogue for this scene, add another glitch.

You already wrote code for a glitch.

Now, you will reuse it.

In computer science, this type of code reuse is called a “procedure.”

Computers often perform the same action many different times in a program.

Placing the code for a specific action into a procedure allows the program to “call” the procedure whenever it needs to make that action happen.

To make a procedure in Scratch, make a new block.

In this case, you will make a “glitch” block that you can reuse.

Click “more blocks” and “make a block.”

Name the block “glitch,” and click okay.

You created a “define” block.

The code you add under the “define” block will run each time the new block is run.

Add the code for your glitch under the “define” block.

Click the “define” block to make sure it contains the correct code.

Next, add the “glitch” block from the “more blocks” menu back into your code.

Click the flag to test.

Great!

It still works.

Use the glitch block again to create a glitch in the second scene of your story.

Try it again.

Awesome.

Now that you’ve created a block for the glitch, you can use it whenever you’d like a glitch to happen in your story.

In the next video, you will conclude your story and learn other ways you could add to it.

Now it’s your turn: For your main character, use a “when backdrop switches to” block to continue dialogue.

Use “say for 2 seconds” and “wait” blocks to build more into your story.

And finally create a “glitch” block, and use it twice in your story.

Instructions
  1. For your main character, use a "when backdrop switches to" block to continue dialogue.
  2. Use "say for 2 seconds" and "wait" blocks to build more into your story.
  3. Create a "glitch" block, and use it twice in your story.