public void using(Gun gun) { if (guns == null) { guns = new HashMap<GunType, Gun>(); } if (guns.get(gun.type()) != null) { guns.get(gun.type()).updateFrequency(); } else { gun.updateFrequency(); guns.put(gun.type(), gun); } }
public void paintAllGuns(Graphics g) { for (Gun gun : gunList) { gun.goUp(); } if (!gunList.isEmpty()) { for (Gun gun : gunList) { // System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ATACK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); gun.paintGun(g); } } }
public void drawGun(Gun gun, Graphics g) { g.drawImage( gun.getImage(), gun.getX(), gun.getY(), gun.getX() + 100, gun.getY() + 50, 0, 0, 100, 100, null); }
public void updateGuns() { try { int i = 0; // System.out.println("Nro guns: ..............."+gunList.size()); for (Gun gun : gunList) { if (gun.getYM() <= 0) { gunList.remove(gun); } // System.out.println("Gun nro: "+i+";......................ym= "+gun.getYM()+"; xm= // "+gun.getXM()); i++; } } catch (Exception e) { System.out.println("error in the updateGuns!!!!"); } }
public void maybe_fire_guns() { Enumeration gs; Gun gun; TwoWheeledVehicle v; gs = this.guns.elements(); while (gs.hasMoreElements()) { gun = (Gun) gs.nextElement(); if (gun.firing()) { gun.fired_flag = true; v = gun.vehicle_hit_by(world); if (!(v == null)) { gun.apply_to_vehicle(v); } } } }