Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will make a simple JavaScript game that will break the canvas up into 64X64 pixel squares. You will use a 2D array to dynamically

You will make a simple JavaScript game that will break the canvas up into 64X64 pixel squares. You will use a 2D array to dynamically draw a simple maze consisting of bricks and trees. The player will push 1 of four buttons moving their character in that direction one square. If the player runs into a monster the player will attack the monster (But not move to the square). After the player has moved all of the monsters will move, if the monster moves on the player it will attack the player (but not move to the square). Monsters and Players cannot move through trees or walls. There will be at least 2 potions on the map that will restore the players health if they move on to them. (The potion will then be destroyed after it is collected). If all the monsters have died then print You Win on the screen. If the player is killed, then you will print Game Over. Both the monsters and the hero will have the following properties:

HP Health

MHP Max health

ATK Attack bonus

DEF Defense bonus

X X coordinate (on the grid not the pixel value)

Y Y coordinate (on the grid not the pixel value)

PIC The variable pointing to the html image for the appropriate character.

Both the player and the monster will be rendered by images, they will also have a health bar next to them. (You pick the orientation). The images will be rendered on the appropriate grid based on the X and Y value. Since both the hero and the monster use the same render function you may want to use inheritance. For combat you will follow the equation: Damage = (other.ATK-this.DEF or 1 whichever is higher)*random number 1-6. Again this could be implemented in a parent class. You will have three monsters with varying difficulty and one hero. I will let you decide what the attributes should be. The game should be challenging but not impossible. Submit a zipped folder with all your files inside it. The tree and the rock/wall will be rendered through the 2D context draw functions.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions