please review the info below Upload your .java file(s) to Ecampus or Present the program to the class or demo to instructor during open

please review the info below

Upload your .java file(s) to Ecampus or Present the program to the class or demo to instructor during open lab.

Complete your game that was begun in Homework 4.  The game should be in a single file.  It should have the following components:

1.  An original theme
2.  Introduction screen with color ASCII art and text describing your game and theme
3.  Ending screens for player win and lose
4.  Enemies should be moved into an ArrayList
5.  Enemies can attack the player and vice versa
6.  Enemies will move toward the player
7.  A variety of Items should be added to your World such as health power-ups

Here is some code that will help:

// create an ArrayList of Enemy class and add some objects

// this belongs at the top of your program after you have created your player object

ArrayList<Enemy> Enemies =
new
ArrayList<Enemy>();

Enemies.add(
new Enemy(“Orc”));

Enemies.add(
new Enemy(“Dragon”));

// step through Enemy ArrayList and attack if adjacent to player

// this belongs in the gameloop after the player has moved

for (int i=0; i<Enemies.size(); i++)

{

if ((Enemies.get(i).Ypos == P.Ypos && (Enemies.get(i).Xpos == P.Xpos+1)) || // player is to the left

(Enemies.get(i).Ypos == P.Ypos && (Enemies.get(i).Xpos == P.Xpos-1)) || // player is to the right

(Enemies.get(i).Xpos == P.Xpos && (Enemies.get(i).Ypos == P.Ypos+1)) ||  // player is above

(Enemies.get(i).Xpos == P.Xpos && (Enemies.get(i).Ypos == P.Ypos-1))) // player is below

{

Enemies.get(i).HP -= P.Attack; // Player attacks Enemy

P.HP -= Enemies.get(i).Attack; // Enemy attacks Player

// Here is a more advanced attack formula that utilizes attack and armor values.

// P.HP -= (100 * Enemy.get(i).Attack) / (100 + P.Armor)

if (Enemies.get(i).HP <= 0) // Enemy dies

{

P.World[Enemies.get(i).Xpos][Enemies.get(i).Ypos] = ‘ ‘;

Enemies.remove(i);

}

}

}

// step through Enemy ArrayList and move towards the player

// optionally add a range variable so enemies only move towards player if within range

for (int i=0; i<Enemies.size(); i++)

{

if (Enemies.get(i).Xpos > P.Xpos)

Enemies.get(i).MoveLeft();

else

Enemies.get(i).MoveRight();

if (Enemies.get(i).Ypos > P.Ypos)

Enemies.get(i).MoveUp();

else

Enemies.get(i).MoveDown();

}

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective:

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective: Students will design, simulate, and analyze the architecture of a simplified computer system, applying concepts from Stephen D. Burd’s materials such as the CPU, memory hierarchy, I/O, and instruction set architecture (ISA). Components: 1. System Design: . CPU Design:

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective:

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective: Students will design, simulate, and analyze the architecture of a simplified computer system, applying concepts from Stephen D. Burd’s materials such as the CPU, memory hierarchy, I/O, and instruction set architecture (ISA). Components: 1. System Design: . CPU Design: