Whack-a-Mole App
Whack-a-Mole App
Animation Cheat Sheet
Basic formula for an animation:
elementName.animate().animation(arg).setDuration(milliseconds);
Animations:
translationXBy(int dps), Moves the image from its current location on
translationYBy(int dps) the x- or y-axis by a certain amount
expressed in dps (dp = 1 pixel)
Timer Guide
The timer code goes inside onCreate.
Handler handler = new Handler();
Runnable run = new Runnable() {
@Override
public void run() {
// This code will run every x milliseconds
handler.postDelayed(this, x);
}
};
handler.post(run);
Additional Features:
● Make the mole disappear when the user clicks it and then reappear in a new place
● Make the mole start out moving slowly and then have its speed increase when the
user earns certain scores (e.g. 10 points, 20 points, etc).
● Give the user a 60-second timer limit and shut them out of the game after that.
● What else can you think of?