INQ241B
Mobile Apps

Activity 3

Extend the Mole Mash App

  1. Add a reset button to the game. When the user presses the button, the score and health should be set back to their original values.

  2. The MoleMash app gets monotonous pretty quickly. One way to remedy this is to make the game more difficult. Modify the blocks so that every time the user hits a mole, the delay until the next mole appears becomes a little less. Note that the clock's TimerInterval is in milliseconds, so a change in the delay that is small will take many hits before there is a noticeable difference in the mole's movement. Note, the reset button should set the delay back to the original amount.

  3. Add a health bar to the MoleMash app. Modify the user interface for the app by removing the display of the number of misses and replacing it with a label that does not display text, is 100 pixels wide, and has a background color. Modify the blocks so that whenever the player misses a mole the width of the label is reduced. Note, the reset button should reset the health bar to 100 pixels wide.

  4. Add the ability for the MoleMash game to end. Modify the blocks so that if the health bar becomes empty, then moles should stop appearing randomly and the text "Game Over" should be displayed in the canvas. Note, the reset button should start playing the game again.