Lab #43 Whack A Mole

Lab #43 is titled, "Whack A Mole". As the title indicates, I created a webpage that allows you to play the game, Whack A Mole. In order to play the game, you first press the start button. The moles are going to start coming out one by one, and pretty fast too. Your objective is to click on the moles before they enter back their hole. Your score is calculated next to the "Whack-a-mole!" text. Once the game is over and the moles stop spawning, you can click start again to reset your score and have another shot at it.


Creating this game had a lot of elements applied to it. Since there is so much to it, I will only be going over the important parts that make the website function properly. Within the HTML document, I created many divs (6) in order to represent holes where the moles would be hiding in and would pop out from. I then added another div within each div hole which would consist of a mole. So technically, all of the holes have a mole within it, it's just that they aren't visible. I also created a start button that would run a function to begin the game. As to what that function actually does, it sets the score at the top to 0, because you're technically starting a new game each time you press it. It will also set up the game and start up the other functions which control the holes in which the moles pop out of the holes. These functions use a random number generator to determine which hole a mole will spawn in. This means that the holes which the mole pop out of, are never always the same, but will be different each time a new game begins. After a certain amount of time, the moles will stop spawning, indicating the game is over. To retry at the game, you would click the start button again.

A game created within a website is really impressive. If web designers could create more unique games, it will attract many users, including me, because I'm a gamer. Utilizing JavaScript to make a game within a website, will not only be attracting, but it would also qualify that web designer serious skills as it is something that requires lots of JavaScript. This would also open up a web designer for being hired for jobs due to their creativity.

Comments

Popular posts from this blog

WBL Workshop #6 Interview Skills

CTE Expo Reflection Journal

Lab #12 Reflection