Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Net beans Write a program that creates a text based video game. You will allow a player to control their actions, and create random

Java Net beans

Write a program that creates a text based video game. You will allow a player to control their actions, and create random events such as monsters to fight, prize chests, and a final battle at the end of the level. Refer to the character the user is playing as the main character, things you fight as monsters or the final boss.

Your main program will need to be in a loop until the end of the level when the main character enters the boss fight. You should go through the loop 10 times, and each time you will generate a random number between 1-5 that controls what happens to the player:

If a 1 or a 2 print to the screen You keep walking

If a 3 or a 4, print to the screen You encountered a monster! and begin a monster battle.

If a 5, print to the screen Hmma treasure chest. I wonder whats inside

If the main character is still alive after the end of the 10th iteration of the loop, you will enter the final boss battle.

The main character, monsters, and final boss should each inherit from a class called creature. This class should contain a variable called HP (for health points) and Max Attack Points, which is the highest amount of damage that can be dealt by that creature. It should also have a function called Basic Attack which reduces the opponents HP by a randomly generated value between 1 and the attacking creatures Max Attack Points.

The Main Characters HP should be set to 80 and Max Attack Points to 20.

The Monsters HP should be set to 15 and Max Attack Points to 5.

The Final Boss HP should be set to 100 and MaxAttackPoints to 20.

The main character class should have a function called sleep attack that deals 5 points of damage, but has a chance of making the targeted monster sleep through his next attack phase

The final boss class should have a special attack function defined by you (your choice how it works!)

The monsters dont have any special attacks.

The fights should cause you to enter a while loop where the main character faces his/her opponent until one of the characters HPs reaches zero

The main character always gets to attack first

The result of each attack (e.g. amount of HP etc) should be printed to the screen

After each attack, the player should get an update on HP

At the end of each fight, the result of the fight should be printed to the screen (e.g. You won this fight! or Youve lost!

If its a boss fight it should also indicate that the player has won or lost the game based on the outcome of the boss fight.

When the player encounters a chest, randomly generate a number between 1-3 that controls whats inside:

If 1, add 10 HP and say You gained a little life!

If 2, add 20 HP and say You gained a lot of life!

If 3, print Hemthis box appears to be empty

Written:

Pseudo code: Write a pseudo code for this project

UML diagram: Include UML diagrams for each class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions

Question

What is the coefficient of determination and how is it computed?

Answered: 1 week ago