Class AssetManager

java.lang.Object
dev.kyzel.utils.AssetManager

public class AssetManager extends Object
A class to store all the assets of the game.
  • Field Details

    • tileMap

      public static HashMap<String,BufferedImage> tileMap
      The list of all tiles that can be used in the game.
    • downImage

      public static BufferedImage[] downImage
      The list of player's sprites when moving down.
    • upImage

      public static BufferedImage[] upImage
      The list of player's sprites when moving up.
    • rightImage

      public static BufferedImage[] rightImage
      The list of player's sprites when moving to the right.
    • leftImage

      public static BufferedImage[] leftImage
      The list of player's sprites when moving to the left.
    • downSwimmingImage

      public static BufferedImage downSwimmingImage
      The player's sprite when swimming to down.
    • upSwimmingImage

      public static BufferedImage upSwimmingImage
      The player's sprite when swimming to up.
    • rightSwimmingImage

      public static BufferedImage rightSwimmingImage
      The player's sprite when swimming to the right.
    • leftSwimmingImage

      public static BufferedImage leftSwimmingImage
      The player's sprite when swimming to the left.
    • slimeImage

      public static BufferedImage[] slimeImage
      The list of slime's sprites.
    • ghostImage

      public static BufferedImage[] ghostImage
      The list of ghost's sprites.
    • zombieDownImage

      public static BufferedImage[] zombieDownImage
      The list of zombie's sprites when moving down.
    • zombieUpImage

      public static BufferedImage[] zombieUpImage
      The list of zombie's sprites when moving up.
    • zombieRightImage

      public static BufferedImage[] zombieRightImage
      The list of zombie's sprites when moving to the right.
    • zombieLeftImage

      public static BufferedImage[] zombieLeftImage
      The list of zombie's sprites when moving to the left.
    • emptyHeartImage

      public static BufferedImage emptyHeartImage
      An empty heart image that is used for the HUD.
    • fullHeartImage

      public static BufferedImage fullHeartImage
      An full heart image that is used for the HUD.
    • halfHeartImage

      public static BufferedImage halfHeartImage
      An half-empty heart image that is used for the HUD.
    • tilesName

      private static final String[] tilesName
      The list of all the tiles' name
  • Constructor Details

    • AssetManager

      public AssetManager()
  • Method Details

    • loadAllRes

      public static void loadAllRes(int unitSize)
      Loads all resources for the game.
      Parameters:
      unitSize - the unit size of the Renderer
    • loadZombieImage

      private static void loadZombieImage(int unitSize)
      Loads all zombie's sprites.
      Parameters:
      unitSize - the unit size of the Renderer
    • loadHeartImage

      private static void loadHeartImage(int unitSize)
      Loads all of the heart's images.
      Parameters:
      unitSize - the unit size of the Renderer
    • loadPlayerImage

      private static void loadPlayerImage(int unitSize)
      Loads all player's sprites.
      Parameters:
      unitSize - the unit size of the Renderer
    • loadTileImage

      private static void loadTileImage(int unitSize)
      Loads all tiles' textures.
      Parameters:
      unitSize - the unit size of the Renderer
    • loadResource

      private static BufferedImage[] loadResource(String path, int unitSize, int numOfSprite)
      Loads a certain number of resources into an array.
      Parameters:
      path - the path of the resources
      unitSize - the unit size of the Renderer
      numOfSprite - the number of sprites to load
      Returns:
      the array of loaded resources
    • loadResource

      private static BufferedImage loadResource(String path, int unitSize)
      Loads and scales a resource file.
      Parameters:
      path - the path of the resource
      unitSize - the unit size of the Renderer
      Returns:
      the loaded and scaled image
    • scaleImage

      private static BufferedImage scaleImage(BufferedImage image, int unitSize)
      Scales the given image into the given unit size.
      Parameters:
      image - the given image
      unitSize - the given unit size
      Returns:
      the scaled image