Make a Maze Game, Part 3During class we talked about counting caloires.
In general, you should eat no more than 2000 calories each day (for your exact number go to: bit.ly/techbrarian_calorie). There’s more to eating than calories-- like the biggest enemy sugar and your best friend: fiber. But for now, let’s just use the idea of calories for your maze.
1. Start by going to google.com and click on “Images”.
2. Look up an unhealthy food.
3. Drag a picture of the food you want onto the desktop.
1
4. Now, import your unhealthy food as a new sprite.
5. Make sure that “Desktop” is selected. Double-click on your first unhealthy food (BTW, your’s doesn’t have to be a bacon cheeseburger).
6. Use the Eraser Tool to erase the background of your unhealthy food.
2
7. Click on “Scripts”. Shrink the unhealthy food and place it where you want it.
It’s always smart to name your Sprites because it helps make your scripts sound like real sentences. So let’s name your burger.
8.
Click on the burger’s “i”.
9. Name your unhealthy food. Click the arrow to return back.
3
10. Now, click on “Scripts” and in the “Data” section select “Make a Variable”.
A variable is something that changes. Most of the things that you can change in Scratch like your Sprite’s location, color, and the sounds it makes are built into the code blocks that Scratch gives you. But there’s something that changes in your maze game that Scratch doesn’t have in its code blocks: calories. Your maze game is about how the calories you’ve eaten change depending on which foods you touch, right? Well, you’re going to have to create a code block that says that.
11. Call your variable “calories”.
4
12. Now create the following code:
The code says “if your unhealthy food touches the maze runner, than the calories go up by 1.” But my unhealthy food is much more than 1 calorie. So how many calories is my unhealthy food? Let’s look it up online. Remember, my unhealthy food is a bacon cheeseburger, but you pick whatever food you wnat!
13. Go to CalorieKing.com. Search for your unhealthy food.
5
14. Select the unhealthy food that best matches what you were imagining.
15. Memorize the calories and return back to your Scratch maze.
6
16. Change the calories from 1 to the number of calories you found your unhealthy food really had.
17. Lastly, drag code to make the food hide once it’s touched by the maze runner. Though, don’t forget to have it show when the green flag is clicked (when the game starts over).
7
18. Now repeat all the steps until you have at least 5 unhealthy foods and 5 healthy foods.