Advertisement
GamingTimelord19

Enemy.java

Oct 22nd, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1.  
  2. import java.util.Random;
  3.  
  4. public class Enemy {
  5.  
  6.     public int xPos;
  7.     public int yPos;
  8.     public int mHealth;
  9.     public int health;
  10.     public int type;
  11.     public int level;
  12.  
  13.     public final int ORC = 0;
  14.     public final int GOBLIN = 1;
  15.     public final int ADDER = 2;
  16.     public final int HOBGOBLIN = 3;
  17.     public final int BAT = 4;
  18.     public final int RAT = 5;
  19.     public final int DEMON = 6;
  20.     public final int ANT = 7;
  21.     public final int ZOMBIE = 8;
  22.     public final int TROLL = 9;
  23.  
  24.     public Enemy(int x, int y, int floor) {
  25.         xPos = x;
  26.         yPos = y;
  27.         if (floor >= 1 && floor <= 5) {
  28.             Random r = new Random();
  29.             int monsterSelect = r.nextInt(4) + 1;
  30.             switch (monsterSelect) {
  31.                 case 1:
  32.                     type = ORC;
  33.                     level = floor * 2;
  34.                     mHealth = 25;
  35.                     health = 25;
  36.                     break;
  37.                 case 2:
  38.                     type = BAT;
  39.                     level = 1;
  40.                     mHealth = 5;
  41.                     health = 5;
  42.                     break;
  43.                 case 3:
  44.                     type = ADDER;
  45.                     mHealth = 10;
  46.                     health = 10;
  47.                     break;
  48.                 case 4:
  49.                     type = RAT;
  50.                     mHealth = 10;
  51.                     health = 10;
  52.                     break;
  53.                 default:
  54.                     break;
  55.             }
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement