marwanpro

Untitled

May 18th, 2016
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. public class Tools
  2. {
  3.   /*
  4.    * Tools Class
  5.    * Description: Contains tools.
  6.    *
  7.    * init void: Initialize arrays
  8.    * updateBulletAlive void: Check how many bullets are alives
  9.    * updateEntityAlive void: Check how many entities are alives
  10.    * randInt int: Generate a random integer in a range of two intergers
  11.    *
  12.    */
  13.  
  14.   void help()
  15.   {
  16.     JOptionPane.showMessageDialog(frame,
  17.     "Welcome to ProcesShoot, a shoot'em up game ! \n" + "Arrows Keys: Move Player\n" + "SpaceBar / W: Shoot\n" + "ALT / X: Bomb",
  18.     "Welcome to ProcesShoot",
  19.     JOptionPane.QUESTION_MESSAGE);
  20.   }
  21.  
  22.   void init()
  23.   {
  24.     for (int i = 0; i < player.bulletLimit; i++)
  25.     {
  26.       fireObject[i] = new FireObject();
  27.     }
  28.     for (int i = 0; i < player.entityLimit; i++)
  29.     {
  30.       entity[i] = new Entity();
  31.     }
  32.   }
  33.  
  34.   public void updateBulletAlive()
  35.   {
  36.     event.BulletsAlive = 0;
  37.     for (int i = 0; i < player.bulletLimit; i++)
  38.     {
  39.       if (fireObject[i].alive == true) { event.BulletsAlive++; }
  40.     }
  41.   }
  42.  
  43.   public void updateEntityAlive()
  44.   {
  45.     event.EntitiesAlive = 0;
  46.     for (int i = 0; i < player.entityLimit; i++)
  47.     {
  48.       if (entity[i].alive == true) { event.EntitiesAlive++; }
  49.     }
  50.   }
  51.  
  52.   public int randInt(int low, int high)
  53.   {
  54.     int r = int(random(low, high + 1) - 0.000001);
  55.     return r;
  56.   }
  57.  
  58. }
Add Comment
Please, Sign In to add comment