Egg Wrecker - A Simple Javascript Game

 Good Day Everyone!

Today we will be talking about a simple Javascript game. The Game is called Egg Wrecker. It is based on a game called Battle Ships where the user set coordinates, launches an attack and if it lands a hit, the player gets a point.

Below is a sample vlog of the game as well


The same concept applies to Egg Wrecker it's just that the characters instead of ships, the player attacks nest of eggs hidden on a Four row and Four Column 2D Array. The 2D Array has randomized 0s and 1s. If the player launches an attack to a coordinate say for example row 1 and column 4, if the coordinate has a value of 1, the player gets a point otherwise no point is given.



 

Egg wrecker is a fun game to play for all ages. As long as you have the imagination and the luck of a rocket launcher, this game is for you! The game can be played on Desktop or any mobile device. 

The backstory for this game is show below

"The chickens have layed their eggs in the dog's territory. Since the dogs are very territorial, whoever tresspasses will face the consequences. You will play as one of the dogs to destroy the chicken's nests of eggs.

Dog's have rockets with ammo. Chicken's have hidden their eggs on the field. The Dog's have no idea where exactly the eggs are hidden so you will have to launch attacks based on the field's coordinates and hopefully it lands a hit.

The chicken's plan to retrieve their eggs to save their kind. Wreck the eggs before they do so that they will never come back!" 

 

STEP 1:

  

Notice that the field to launch rockets to is a size of Four by Four. 

STEP 2:

Set the Coordinates to target the field. Then click Launch


STEP 3:

The eggs are hidden somewhere in the field. You must guess which has eggs on them. When your attacks lands a hit, it will deduct the number of eggs. The field coordinates hit will become a crater when your attack lands a hit or a miss. 

 

STEP 4:

 

 

The game ends if your Ammo is zero or you have wrecked all eggs on the field or if time limit has been reached.  


HOW IS THE GAME CONSTRUCTED?

Egg Wrecker is constructed in HTML, CSS and Javascript

The main logic of the game is set to have constant 2D array with a size of 4 row and 4 column.
The 2D Array has random 0s and 1s as its elements. The player will have to guess which array element location has a 1 or 0. If the player's guess has a 1 on it, the player gets a point.

If you know the game battle ships, you will have a brief idea on the game's concept. Easy right?

You can access the game using this link

https://ramlittle.github.io/eggwrecker/

The game is constructed by Ram Little. Images used here are credited to each original owner.

Hope you find the game fun and interactive. If you have any questions or suggestions, please leave a comment down below

Cheers!

Comments