Spanish Mad libs with Scratch
Mad Libs Concepts Ask the player for words Store the words Display the story Variable – something that changes Strings are groups of characters
What’s a variable? Give me an example? A container to store a value Give me an example? In shapes drawing program the number of sides in the shape might be a variable Or length of side
What’s a STRING? Give me an example? Name in a Leader board A type of data or value made of words, letters, spaces or numbers A group of characters You can join two strings together You need to add spacing between strings Give me an example? Name in a Leader board Mad Libs words Title of a track, film, book
Project Description We will ask the user some questions and then create a "madlib" from the answers
Big Picture Delete the cat sprite Choose a sprite from a file Do set-up Make all the variables Ask user a question Set answer to a the variable Duplicate the script for the number of variable in your story Create a string to say the result Delete the cat sprite Choose a sprite from a file Program the sprite Create a script
Creating a Variable Go to the Data category Click on "Make a Variable" Give your variable a unique name For example verb1, food, etc. When you create a list you get new tiles (blocks) that help you work with the list. The list will automatically be displayed. You can turn this off by unchecking the checkbox.
Program the Sprite We want to ask the user a question for each changing word in your story Name Favorite color Favorite Animal Use the "ask and wait" tile in the Sensing category
Saving the answers Each time we ask a question the answer is put in the answer tile – in Sensing To save the answers let's add them to a variable
Set-up and ask questions When the green flag is clicked Hide variable answers Show the plain background Ask each question Set each answer to the variable
Display your MAD Lib with ANSWERS Create a new Background Type the story leave spaces for words the user gives Use Vector Mode Using multiple joins You can use more than one join First drag out one join. Then add another in the second slot. Then add a third in the 2nd slot of the 2nd. Then drag out the item at position in list.
Displaying the MadLib You can join two strings together Using join tile from Operators You can get an item from a position in the list
Using variables with strings You can make a variable Like sentence You can set the variable to the result of a join Remember to include spaces
Final Code
Senor Salzman’s Scratch SPANISH Mad Libs Example
Extra time Change cat sprite Make the cat glide and speak Click the cat see the x,y Go to coordinate graph x,y Change the sprite costume Or right click on the cat and select delete
Extra time Choose a new Sprite Select the choose a sprite from a file Go to the People category Pick a sprite to use