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

 The Rest of the resources and instructions are provided in the screenshots below. You will need the Project overview to complete this

 The Rest of the resources and instructions are provided in the screenshots below. You will need the Project overview to complete this assignment. Project Overview This project includes the following tasks: Gather product information Analyze and differentiate product vulnerabilities Recommendation based on empirical data collection Objective: Product Selection Recommendation Organizations

 How Does Surescripts Integration Improve Prescription Management?  The Future of E-Prescriptions: Why Surescripts Integration is a Must-Have In

 How Does Surescripts Integration Improve Prescription Management?  The Future of E-Prescriptions: Why Surescripts Integration is a Must-Have In today’s fast-evolving healthcare landscape, seamless data exchange is essential for improving patient care and optimizing workflows. Surescripts integration solutions provide a secure and efficient way to connect pharmacies, healthcare providers, and electronic

[url= Integration Services[/url] are transforming businesses by streamlining operations, enhancing customer experiences, and enabling data-driven

[url= Integration Services[/url] are transforming businesses by streamlining operations, enhancing customer experiences, and enabling data-driven decisions. By automating repetitive tasks, AI frees up resources for more strategic activities, improving productivity. AI tools like chatbots and recommendation engines offer personalized solutions, fostering customer loyalty. AI also helps businesses analyze large datasets