package com.arvin;
import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List;
public class StaticValue {
public static BufferedImage BackgroundImage_Noe = null; public static BufferedImage BackgroundImage_Two = null; public static BufferedImage Jump_Left = null; public static BufferedImage Jump_Right = null; public static BufferedImage Stand_Left = null; public static BufferedImage Stand_Right = null; public static BufferedImage Tower = null; public static BufferedImage Gan = null;
public static List<BufferedImage> Obstacle = new ArrayList<>();
public static List<BufferedImage> Run_Left = new ArrayList<>(); public static List<BufferedImage> Run_Right = new ArrayList<>();
public static List<BufferedImage> Mogu = new ArrayList<>();
public static List<BufferedImage> Flower = new ArrayList<>();
public static String Path = System.getProperty("user.dir") + "/src/images/";
public static void Init(){
try { BackgroundImage_Noe = ImageIO.read(new File(Path + "bg.png")); BackgroundImage_Two = ImageIO.read(new File(Path + "bg2.png")); Jump_Left = ImageIO.read(new File(Path + "s_mario_jump1_L.png")); Jump_Right = ImageIO.read(new File(Path + "s_mario_jump1_R.png")); Stand_Left = ImageIO.read(new File(Path + "s_mario_stand_L.png")); Stand_Right = ImageIO.read(new File(Path + "s_mario_stand_R.png")); Tower = ImageIO.read(new File(Path + "tower.png")); Gan = ImageIO.read(new File(Path +"gan.png")); } catch (IOException exception) { exception.printStackTrace(); }
try { Obstacle.add(ImageIO.read(new File(Path + "brick.png"))); Obstacle.add(ImageIO.read(new File(Path + "soil_up.png"))); Obstacle.add(ImageIO.read(new File(Path + "soil_base.png"))); } catch (IOException exception) { exception.printStackTrace(); }
try { Obstacle.add(ImageIO.read(new File(Path + "brick2.png"))); Obstacle.add(ImageIO.read(new File(Path + "flag.png"))); } catch (IOException exception) { exception.printStackTrace(); }
for (int i = 1; i <= 4; i++) { try { Obstacle.add(ImageIO.read(new File(Path + "pipe" + i + ".png"))); } catch (IOException exception) { exception.printStackTrace(); } }
for (int i = 1; i <= 2; i++) { try { Run_Left.add(ImageIO.read(new File(Path + "s_mario_run" + i + "_L.png"))); } catch (IOException exception) { exception.printStackTrace(); } }
for (int i = 1; i <= 2; i++) { try { Run_Right.add(ImageIO.read(new File(Path + "s_mario_run" + i + "_R.png"))); } catch (IOException exception) { exception.printStackTrace(); } }
for (int i = 1; i <= 3; i++) { try { Mogu.add(ImageIO.read(new File(Path + "fungus" + i + ".png"))); } catch (IOException exception) { exception.printStackTrace(); } }
for (int i = 1; i <= 2; i++){ try { Flower.add(ImageIO.read(new File(Path + "flower1." + i + ".png"))); } catch (IOException exception) { exception.printStackTrace(); } }
} }
|
版權聲明: 此文章版權歸Arvin所有,如有轉載,請註明來自原作者