Directions for creating your own Mad Libs program using Scratch. Adapted by Janet Piehl. Use this instuctions along with MIT's free computer animation program, Scratch to make your own interactive Mad Libs game.
08448380779 Call Girls In Civil Lines Women Seeking Men
Scratch Mad Lib Games
1. 1
Mad Lib
Wilmette Public Library
January 19, 2013
jpiehl@wilmettelibrary.info
Have you ever done a Mad Lib? A story is written with missing words. Your friend can see the
story, but you can’t. She asks you for a series of words and puts them in the blanks left for the
missing words. Then she reads the story back to you, with the words you suggested filled in. The
result is a very silly story!
We can do this not just on paper but with Scratch! You’ll make up a simple story and ask the
user to fill in missing words. Then two characters will tell the story, with the suggested words
plugged in. You’ll also add sound effects and movement.
What will we learn?
Speech: ask, answer, and join
Sprite interaction
Animation/costume changes
Sound effects
1. Background
To get started, you’ll need to choose a background. Click on Stage, then the Backgrounds tab,
then Import. Pick Bedroom1 from the Indoors folder. Then delete the blank background by
clicking on the x next to it.
Now click on the Scripts tab. When the program starts, you want this background to appear.
Drag out When Green Flag clicked, from the Control category, and then attach Switch to
Background <bedroom1> from the Looks category.
2. The Friend
Now we’ll create the Friend, the person who explains the game and then asks the user for the
words that will be plugged into the story.
First get rid of the Cat sprite by right-clicking on it in the Sprites List and selecting Delete. Now
click on the Choose New Sprite from File folder. Pick Girl4-sitting, from the People folder. Drag
the sprite across the stage to the place you want it to be. Be sure to name the sprite. In the box
above the Scripts area, fill in its name, Friend.
When the program starts, the Friend appears. Drag out When Green Flag Clicked and attach
Show. Then we’ll make her start talking. Attach three Say <> for <2> Secs blocks from Looks. In
the first one, type <Let’s make up a story!>. In the second one, type <First I’ll ask you for some
words.>. In the third one, type <Then we’ll use them to make an animation.>. The Friend will
2. 2
then ask four questions. Under Sensing, there is an Ask block. Attach an Ask <> and Wait block,
and inside the space, type <What’s your name?>
Later in the program, the answer to this question will appear in a story. To make this happen,
we have to set up a variable. Go to the Variables category and click on Make a Variable. When
prompted, call it Name. Now a series of blocks will appear in the blocks palette. Drag out and
attach Set <name>. In the blank, insert an Answer block from Sensing. This means that the
variable Name will be set to the answer a user gives when asked for his name. This will allow the
response to appear later on.
We’ll do this three more times. Make three more variables: Thing1, Thing2, and Action. Uncheck
the boxes next to them in the blocks palette so they don’t appear on the stage.
Now attach: Ask <Please name a thing.> and Wait, then by Set <Thing1> to <answer>.
Ask <Please name another thing.> and Wait, then Set <Thing2> to <answer>.
Ask <Please name a verb.> and Wait, then Set <Action> to <answer>.
The Friend will signal that we’re moving on to the story. Attach Say <On to the story!> for <2>
Secs. After that, we’ll attach a broadcast. A broadcast is an invisible message from one sprite to
another. It has a sending end and a receiving end. This is the sending end. Get a Broadcast block
from Control. Create a new broadcast by clicking on the arrow in the block. Call it Start Story.
After that, the Friend disappears. Attach Hide.
3. The Story Background
When the story starts, we want the background to change. Click on Stage again and import a
new background. Pick Spotlight-stage from the Indoors folder. Go back to the Scripts area. Now
we’ll create the receiving end of the broadcast we just made. Drag out When I Receive <Start
3. 3
Story>. We’ll make the background change to Spotlight-stage. Attach Switch to Background
<Spotlight-stage>.
4. The First Character
We need two characters to tell the story. They’ll be moving their mouths and saying things.
Let’s make the first one now. Choose a new sprite from the folders. Try Gobo1 from the Fantasy
folder. Then make a second costume. Import Gobo2, whose mouth is in a different position
from Gobo1’s. Name the sprite Gobo. Drag it to the spot on the stage where you want it to be.
Use the Shrink and Grow buttons to adjust its size if necessary.
Now go back to the Scripts tab. When the program starts, this sprite will be hidden. Drag out
When Green Flag Clicked and attach Hide.
Let’s set up the first part of the story. One of the nouns the user suggested will appear here.
When this sprite gets the broadcast to start the story, it will appear and spring into action. Drag
out When I Receive <start story> and attach Show. Attach Say <Hey, guess what!> for <2> Secs.
The next comment will incorporate Thing1. We’ll use a Say block that includes variable Thing1.
To combine the speech and Thing1, we’ll need two Join blocks, from Operators. Drag out two
Join blocks. Insert the first one into the first space in the second one. Now, in the first space,
type <I just got a pet >. (Make sure there is a space after “pet,” otherwise your words will run
together.) In the second space, insert Thing1 from Variables. In the third space, type a period.
This way, the user’s suggestion will appear. For example, if they suggested the word “chair,”
Gobo will say, “I just got a pet chair.”
Now attach Wait <.5> Secs. Then attach a new broadcast, called Response1.
4. 4
We want to make Gobo look like he’s talking. We’ll set up some costume switches so it looks like
his mouth is moving. When Gobo appears, the switches will start and continue while he’s
talking. Drag out When I Receive <Start Story> and attach a Repeat block. You may want to
experiment with the number of times the action repeats, but for now, type 18 in the space at
the top of the Repeat block. Inside it, attach Next Costume and Wait <.2> Secs.
5. The Second Character
Gobo needs someone to talk to. Choose a new sprite from the file, Fantasy1-b from the Fantasy
folder. Copy the sprite to make a second costume. Using the editing tools, erase his mouth and
draw a new one in a slightly different position. Use the Paint Editor to flip both costumes so that
they’re facing Gobo on the stage. Position the sprite where you want it on the stage and use the
Shrink and Grow buttons to adjust the size. Name the sprite Dude.
When the program starts, he’s hidden, so drag out When Green Flag Clicked and attach Hide.
He appears when he receives the broadcast Start Story, so drag out When I Receive <Start
Story> and attach Show.
When Dude receives the broadcast Response1 from Gobo, Dude starts talking. We’ll write
scripts that are very similar to what we did for Gobo, only this time, the variable for Action will
be included. Drag out When I Receive. Drag out a Say block, with two nested Joins and the
Action variable. String them together with dialog so that you attach Say <Join<Join<That’s cool.
Does it like to ><Action>><?>> for 2 Secs. Then attach Wait <.5> Secs. Attach and create a new
broadcast, Response2.
5. 5
We want to make Dude look like he’s talking, too. Create code similar to the code for Gobo.
Drag out When I Receive <Response1> and attach Repeat. Try 10 repetitions—you can adjust it
later. Inside, attach Next Costume and Wait <.2> Secs.
6. Gobo Responds
Gobo will receive the broadcast from Dude and respond. The response will incorporate the
user’s suggestion for Thing2. Drag out When I Receive <Response2> and attach Say <Yes. But
you know what?> for <2> Secs. Now we’ll use those two Join blocks to incorporate the user’s
Thing2 suggestion. Attach Say <Join<Join <It ate my> <Thing2>>< !>> for 2 Secs. Then attach
Wait <.5> Secs, followed by a new broadcast called Response 3.
Again, make it look like Gobo is talking by switching costumes, again repeating the change 18
times.
7. Dude Responds
Dude will respond, laugh, and flip around. His response will incorporate the user’s name
suggestion. Drag out When I Receive <Response 3> and attach Say <That’s so silly.> for <2> Secs.
Now make him laugh. Click on the Sounds tab and then Import. Chose a laughing sound from the
Human folder, Laugh-male1. Click on the Scripts tab again. From the Sounds category, drag out
and attach Play Sounds <Laugh-male1> Until Done.
Now you’ll use the two Join blocks and the Name variable. Attach Say <Join <Join <Hey >
<Name> ><, what should we do now?>> for <2> Secs.
6. 6
Dude then flips 360 degrees. Attach Repeat <10> and insert Turn <36> degrees and Wait
<.001> Secs.
Again, make it look like Dude is talking by switching costumes, repeating the change 20 times.
You’re done! Or, if you want to continue, make the Mad Lib more complicated. Add voices,
music, sound effects, visual effects, or change the story.