示例#1
0
 public static void loadImages() {
   for (String s : Helper.listAllFiles("textures/character/")) {
     String fileName = s.split("/")[s.split("/").length - 1];
     String key = fileName.split("-")[0];
     int x = Integer.parseInt(fileName.split("-")[1]);
     int y = Integer.parseInt(fileName.split("-")[2].split("\\.")[0]);
     BufferedImage[][] image = new BufferedImage[x][y];
     for (int i = 0; i < x; i++) {
       for (int j = 0; j < y; j++) {
         image[i][j] = Helper.getImagePart("textures/character/" + fileName, i, j);
       }
     }
     entityImages.put(key, image);
   }
 }
示例#2
0
 public static void loadMusic() {
   for (String s : Helper.listAllFiles("resources/music")) {
     String fileName = s.split("/")[s.split("/").length - 1].split("\\.wav")[0];
     new Music(fileName);
   }
 }