Build the MoleMash Game
Molemash is a simple game in which a mole (or a picture of your little brother) jumps randomly around the screen and you try to touch it to get points. Build this game and learn how to add timing and randomness into your apps.
These lessons come from USF Professor David Wolber's AppInventor.org - A great resource for learning App Inventor.
They are copied here simply because YouTube is blocked at our school.
Steps: (watch the video for each lesson and follow along)
|
Part 1: Design the user interface and make the mole move randomly
Add a canvas, image sprite, and clock, then code blocks so that the mole moves to a new random spot each interval.
Watch the video and follow along. Any code/settings can be also found below the video.
> Go to http://beta.appinventor.mit.edu/ to begin.
In this step you will need one file (also available on S:\Shared\Students\Tech Ed\App Inventor\Lessons\MoleMash). Click the link to save the file to your desktop.
mole.png
Part 2: Add a point when the user touches the mole
Program the MoleSprite.Touched event to add one to the label showing the score
Watch the video and follow along. Any code/settings can be also found below the video.
Part 3: Subtract a point when the user misses the mole
Change the if clause in the Canvas.Touched into an if-else
Watch the video and follow along. Any code/settings can be also found below the video.
Part 4: Change the app so that an energy bar gets smaller when the user misses
Drag in a label for the bar and define a variable "energy". When the user misses, subtract from energy and change width of label.
Watch the video and follow along. Any code/settings can be also found below the video.
Part 5: Make the game end when energy is zero
When energy becomes 0 tell the user (text-to-speech) and disable the clock and behaviors
Watch the video and follow along. Any code/settings can be also found below the video.
Challenges
Do after completing the videos:
- MANDATORY (-30 if missing): Add a Start button that enables the clock, resets the width of the health bar, resets the global energy variable to zero, and resets the score to zero.
- OPTIONAL: Make the game harder by changing the Timer Event interval to 300ms (making it faster) at 50 points
- OPTIONAL: Make the Mole say "Missed me" when you miss and "Ouch" when you hit it.
- OPTIONAL: Add a second character that subtracts score when you hit it
- OPTIONAL: Add a power up that slows things down for a bit
HINT: Set a Timer.Interval property in code to change the clock speed
Comments (0)
You don't have permission to comment on this page.