This project will teach you how to create game in App Inventor similar to “whack-a-mole” where you have to tap on the pumpkin and the turkey to earn points.


Duration: 20 mins

Level: Beginner

Programming Language: Block-based programming


What you will need:

  1. An account in App Inventor (sign up here by clicking on CREATE)
  2. A laptop or desktop
  3. An android phone or android emulator (you can download Bluestacks here)


Part 1: Design

To create the game, you will need the following components

  1. Canvas, this will be the area where the pumpkin and turkey can go around
  1. Sprite (rename to PumpkinSprite), add in the image of a Pumpkin
  2. Sprite2 (renamed to TurkeySprite), add in the image of the Turkey
  1. HorizontalArrangement1, to arrange the 2 labels into the same horizontal line
  1. Label (rename to HitLabel), add in the words “Hits:”
  2. Label (rename to HitCount), add in the number “0”
  1. HorizontalArrangement2, to arrange the 2 labels into the same horizontal line
  1. Label (rename to MissLabel), add in the words “Misses:”
  2. Label (rename to MissCount), add in the number “0”
  1. Button (rename to Reset)
  2. Sound, add in your preferred sound whenever you click on the sprites
  3. Clock1
  4. Clock2

Part 2: Code

Now, it’s time to code the game.  

  1. To move the PumpkinSprite, you need to find the following blocks to make it move in a random position inside the canvas
  2. You will need the same set of codes but for the TurkeySprite to also make the it move in a random position inside the canvas
  1. When the screen is done loading, it will call the above methods to move the sprites into a random position
  2. When you touch the PumpkinSprite, the HitCount Label will increase by 1 and the sound will play
  3. When you touch the TurkeySprite, the HitCount Label will increase by 5 and the sound will play
  4. When you touch the canvas and miss the sprites, the MissCount label will increase by 1
  5. When the Clock2 timer is set, it will continuously move the Turkey
  6. When the Clock1 timer is set, it will continuously move the Pumpkin
  7. When you click on the button, the HitCount and MissCount label is go back to the number “0”


You can also watch and code along with our instructor here and you can also pin it below!