Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code a boxing game using JavaScript and eclipse that has the following game logic and requirements: The game should put you the Player against an

Code a boxing game using JavaScript and eclipse that has the following game logic and requirements:
The game should put you the Player against an opponent being the Al. There should be 1 boxing character animation for the Al and the Player. The game should allow both the Al and Player to dodge to the right and dodge to the left as well as block and punch. The keys for left dodging should be the left arrow or the letter A on the keyboard. And for the right dodging the keys should be the right arrow or the letter D on the keyboard. For punching it should be a left click or the letter W on the keyboard. And for a block it should be a right click and hold or a click and hold on the space bar. Once the space bar or right click hold is released the blocking should stop. The game will have both the Al and Player fight one round and both the Al and Player will start with 100 health which should be displayed throughout the fight. Once either the Player or Al reaches 0 the game should say whether you the Player won or lost. The game should not work in a way where the player and Al take turns. The Al should be made to make random actions between the left and right dodges and blocking and punching. Every landed punch should take -10 health away from the Player or Al depending on who was punched. The block will have a health bar of 100 that also takes -10 health when a punch lands from the opponent. And it should regenerate +10 health to the block every 3 seconds. If the block reaches 0 then the Al or player should take -10 damage for each punch landed if hit before any block hp is regenerated. There should also be a stamina bar for both the Al and Player. Only dodges and punches will deplete the stamina bar, both dodges and punches should deplete -10 from the stamina bar which will have a maximum of 100 stamina and will regenerate by +10 every 3 seconds. If the Player or Al ever runs out of stamina then there should be a 3 second delay before the stamina starts to regenerate only allowing the Player or Al to block until some stamina is regenerated. Now for the punches it should alternate between each hand for both the player and Al in a pattern. If a punch is thrown first with the right hand then the next punch will always be thrown by the left hand and then the next punch will be the opposite in a constant pattern. There should also be an opportunity to perfect dodge which is performed when dodging in the same direction a punch is coming from at the same time it is thrown. That means dodging to the left when the opponent throws a right punch at the same time the throw it or dodging to the right when the opponent throws a left punch at the same time. The perfect dodge should freeze the Al or Player for 3 seconds if their punch was perfect dodged allowing for the Al or Player to land unavoidable punches in that 3 seconds time. And once the 3 seconds are over the game should unfreeze either the Al or Player that was frozen and continue as normal until either the Player or Al' s health bar reaches 0 and the game displays whether the Player won or lost. Whoever loses whether it be the Players or Al the losers character animation should be laying down and knocked out. And the winners character animation being either the Player or Al should be having both arms raised.
image text in transcribed

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