Пример #1
0
 public Image getImages(String path) {
   try {
     URL url = ImagePack.class.getResource(path);
     img = getToolkit().getImage(url);
   } catch (Exception e) {
     System.out.println("Image - Error: " + e.getMessage());
     e.printStackTrace();
   }
   return img;
 }
Пример #2
0
 public Image[] getEnemyBulletImages(String path1, String path2) {
   imgs = new Image[2];
   try {
     URL url1 = ImagePack.class.getResource(path1);
     imgs[0] = getToolkit().getImage(url1);
     URL url2 = ImagePack.class.getResource(path2);
     imgs[1] = getToolkit().getImage(url2);
   } catch (Exception e) {
     System.out.println("Enemy Bullet Images - Error: " + e.getMessage());
     e.printStackTrace();
   }
   return imgs;
 }
Пример #3
0
  // Method id used to get all the Player Plane Images
  public Image[] getPlayerImages(String path1, String path2, String path3) {
    imgs = new Image[3];
    try {

      URL url1 = ImagePack.class.getResource(path1);
      imgs[0] = getToolkit().getImage(url1);
      URL url2 = ImagePack.class.getResource(path1);
      imgs[1] = getToolkit().getImage(url1);
      URL url3 = ImagePack.class.getResource(path2);
      imgs[2] = getToolkit().getImage(url3);
    } catch (Exception e) {
      System.out.println("Player Plane Image - Error: " + e.getMessage());
      e.printStackTrace();
    }
    return imgs;
  }
Пример #4
0
 // Method to get Explosion Images:
 public Image[] getExplosionImages(
     String path1, String path2, String path3, String path4, String path5, String path6) {
   imgs = new Image[6];
   try {
     URL url1 = ImagePack.class.getResource(path1);
     imgs[0] = getToolkit().getImage(url1);
     URL url2 = ImagePack.class.getResource(path2);
     imgs[1] = getToolkit().getImage(url2);
     URL url3 = ImagePack.class.getResource(path3);
     imgs[2] = getToolkit().getImage(url3);
     URL url4 = ImagePack.class.getResource(path4);
     imgs[3] = getToolkit().getImage(url4);
     URL url5 = ImagePack.class.getResource(path5);
     imgs[4] = getToolkit().getImage(url5);
     URL url6 = ImagePack.class.getResource(path6);
     imgs[5] = getToolkit().getImage(url6);
   } catch (Exception e) {
     System.out.println("Explosion Image - Error: " + e.getMessage());
     e.printStackTrace();
   }
   return imgs;
 }