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

Transcript

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

In this video you will create dialog 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 dialog 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 dialog in this scene with a when backdrop switches to block.

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

Use wait and save for two seconds blocks to sequence dialog between the characters.

After you build out dialog 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 when ever it needs to make that action happen.

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

In this case you would make a glitch block that you can reuse.

Click make a block.

Name the block glitch, and click okay.

You created a defined 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 dialog.

Use save for two seconds and wait blocks to build more into your story.

Create a glitch block and use it twice in your story.

And finally, click the share button so all your friends and family can view your project.

arrow_backward Back
Next arrow_forward
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.