Mini-Project: Create a Customizable Story Generator
Now it's your turn to create a project using what you've learned about variables and parameters. You'll be creating a customizable story generator that asks the user for inputs and then generates a short story based on those inputs.
Project Description
Create a Scratch project that asks the user for various inputs (like a character name, a place, an object, etc.) and then uses these inputs to generate a short story. Use variables to store the user's inputs and parameters to insert them into the story.
Step-by-Step Guide
1. Create variables for each piece of information you want to collect (e.g., "character", "place", "object").
2. Use "Ask [Question] and Wait" blocks to prompt the user for each piece of information.
3. Store the user's answers in the corresponding variables.
4. Create a story template using "Say" blocks, leaving spaces for the variables.
5. Use the "Join" block to combine your story template with the variables.
6. Display the final story to the user.
Example Code Structure
when green flag clicked
ask [What is the main character's name?] and wait
set [character v] to (answer)
ask [Where does the story take place?] and wait
set [place v] to (answer)
ask [Name an object for the story.] and wait
set [object v] to (answer)
say (join [Once upon a time, ] (join (character) (join [ went to ] (join (place) (join [. There, they found a magical ] (join (object) [. The end.])))))) for (10) seconds
Challenge
Can you add more complexity to your story generator? Try adding conditional statements to create different story paths based on the user's inputs. For example, if the place is "forest", the story could involve encountering animals, while if it's "city", it could involve exploring tall buildings.
Remember, creativity is key! Feel free to expand on this basic structure to create more complex and interesting stories. You could add more variables, create longer stories, or even add illustrations that change based on the user's inputs. Don't forget to share your project with your classmates when you're done!