Want more features on Pastebin? Sign Up, it's FREE!
Guest

Main

By: a guest on Dec 6th, 2012  |  syntax: Java  |  size: 0.91 KB  |  views: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package anonymousweaponprototype;
  2.  
  3. import anonymousweaponprototype.classes.Weapon;
  4. import anonymousweaponprototype.classes.WeaponType;
  5. import java.awt.geom.Point2D;
  6. import java.util.Random;
  7.  
  8. /**
  9.  *
  10.  * @author Darin Beaudreau
  11.  */
  12. public class AnonymousWeaponPrototype {
  13.     private static WeaponType Weapons;
  14.    
  15.     public static void main(String[] args) {
  16.         Weapons = new WeaponType();
  17.        
  18.         Weapon [] myWeapons = new Weapon[2];
  19.         myWeapons[0] = Weapons.PISTOL;
  20.         myWeapons[1] = Weapons.FLAMETHROWER;
  21.        
  22.         Random r = new Random();
  23.        
  24.         for(Weapon w : myWeapons) {
  25.             while(w.getAmmo() != 0) {
  26.                 double x = r.nextInt(201);
  27.                 double y = r.nextInt(201);
  28.                 w.fire(new Point2D.Double(x,y));
  29.             }
  30.             System.out.println("\nYour " + w.getName() + " is out of ammo!\n");
  31.         }
  32.     }
  33. }
clone this paste RAW Paste Data