Skip to content

vin-oys/whack-a-mole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whack A Mole

Hit as many moles as possible within 20 seconds! BUTTTTT... please watchout for the baby mole and the bomb!

Description

Instructions

Demo

Demo

Source

This app is inspired by Ania Kubow (https://www.youtube.com/watch?v=lhNdUVh3qCc) & Wes Bos (https://www.youtube.com/watch?v=toNFfAaWghU&feature=emb_title)

Encountered Problem

Initially added addEventListener option once:true to prevent player from abusing the clicking at the same spot to gain multiple points.

It solved the problem, however, another problem arised, which disallow the player to click on the same spot again when the next mole appears.

To solve it, mole position is changed to false every time the event happens.

if (id.id === molePosition) {
    id.classList.remove("mole")
    result += 1;
    molePosition = false;
}

For Further Improvement

  • include a scoreboard to record highscores
  • create different difficulties options
  • include a live event log whenever the player hit an object

About

Whack a mole. Player is required to hit as many moles as possible within the given time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors