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

i need someone to do this homework for me  Technische Informatik 1 Wintersemester 2024/2025 Übungsblatt 9 Bitte Beachten! Diese Hausübung ist

i need someone to do this homework for me  Technische Informatik 1 Wintersemester 2024/2025 Übungsblatt 9 Bitte Beachten! Diese Hausübung ist eine Zulassungsvorraussetzung für die Klausur. Bitte laden sie ihre Lösung entsprechend der Aufgabenbeschreibung in Moodle über den dazu vorgesehenen Punkt bis zum 08.01.25 23:59Uhr auf Moodle hoch. Übung 9

Follow the attach instructions to complete this work. Analyzing a Business Function – Project Management   Must post first. Subscribe Nofsinger

Follow the attach instructions to complete this work. Analyzing a Business Function – Project Management   Must post first. Subscribe Nofsinger Consulting Services uses Project Management techniques to manage client engagements. One of the primary responsibilities of the engagement project managers is ensuring that the advisory services and associated written

Kenya Forestry College [email protected] P.O. BOX 8 -20203, Londiani Tel .No.0202349901, 07232262 APPLICATION FOR TRAINING PROGRAMMES

Kenya Forestry College [email protected] P.O. BOX 8 -20203, Londiani Tel .No.0202349901, 07232262 APPLICATION FOR TRAINING PROGRAMMES 2019/2020 Applications are invited for the following training programmes to be offered at Kenya Forestry College, Londiani commencing on the given dates. S/ n Programme Entry Requirements Duration Commencement Date Total Cost (Ksh) 1