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

IfSuccessful_Status GA_Status_Icon SAM_Logo true false

IfSuccessful_Status GA_Status_Icon SAM_Logo true false ID FirstName LastName AssignmentGUID UserID false rohan maharjan {308B14B0-E32E-42D1-BE7D-54EE2E09B8CD} {308B14B0-E32E-42D1-BE7D-54EE2E09B8CD} ID FirstName LastName ProjectName SubmissionNum MaxScore Score EngineVersion ID StepNumber Description IfSuccessful StepScore StepMaxScore ErrorText ActionName StepActionOrder ConsultantID FirstName Last 110345 Jenette Masterson 110347 Victorina Hogg 110349 Marguerite Hathcock 110351 Sid Ortiz 110352 Glenn Testani

can you complete cis 120 assigment access

can you complete cis 120 assigment access assignment Sheet1 PolicyNumber CustomerID Premium Coverage U20011 11005 215 1,000,000 U21145 11022 226 1,000,000 U22138 11041 278 2,000,000 U22269 11042 301 2,000,000 U20771 11048 315 2,000,000