Creating interactive mad libs in Scratch

Adding a Background

Imagery can help the story by providing design relief and context. On the Old MacDonald Wikipedia page I found a public domain image that I imported as a background to the Stage. Figure 3 shows the Stage with the background in place.

Figure 3: The Old MacDonald background image.

Like the sprites, the Stage background responds to events. Here, it's the two primary events shown in the short scripts shown above: the click of the flag and the create story broadcast message.

Putting It All Together

Figure 4 shows the Old MacDonald nursery rhyme using a set of user-supplied words. When creating the story, I used the change() effect by() block (not shown) from the Looks palette to apply a ghost effect by a factor of 85 to the image, making it fade into the background. A ghost value of 100 would make the image invisible. By fading the image out, I'm keeping a consistent design element through each scene of the project while making the image a secondary element on the Stage so that the background doesn't compete with the story. At the start of the project, the clear graphic effects block resets the background to its original state by undoing the effects of the ghost.

Figure 4: The end result of the story: a new and ever-changing Old MacDonald mad lib.

Now you're ready to create your own mad lib. May I suggest Mary had a little lamb? Happy Scratchin'.

Der Autor

Michael Badger is the author of Scratch 1.4 Beginner's Guide from Packt Publishing. Learn more at http://scratchguide.com.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content