Package dev.kyzel.utils
Class AssetManager
java.lang.Object
dev.kyzel.utils.AssetManager
A class to store all the assets of the game.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic BufferedImage[]
The list of player's sprites when moving down.static BufferedImage
The player's sprite when swimming to down.static BufferedImage
An empty heart image that is used for the HUD.static BufferedImage
An full heart image that is used for the HUD.static BufferedImage[]
The list of ghost's sprites.static BufferedImage
An half-empty heart image that is used for the HUD.static BufferedImage[]
The list of player's sprites when moving to the left.static BufferedImage
The player's sprite when swimming to the left.static BufferedImage[]
The list of player's sprites when moving to the right.static BufferedImage
The player's sprite when swimming to the right.static BufferedImage[]
The list of slime's sprites.static HashMap<String,
BufferedImage> The list of all tiles that can be used in the game.private static final String[]
The list of all the tiles' namestatic BufferedImage[]
The list of player's sprites when moving up.static BufferedImage
The player's sprite when swimming to up.static BufferedImage[]
The list of zombie's sprites when moving down.static BufferedImage[]
The list of zombie's sprites when moving to the left.static BufferedImage[]
The list of zombie's sprites when moving to the right.static BufferedImage[]
The list of zombie's sprites when moving up. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
loadAllRes
(int unitSize) Loads all resources for the game.private static void
loadHeartImage
(int unitSize) Loads all of the heart's images.private static void
loadPlayerImage
(int unitSize) Loads all player's sprites.private static BufferedImage
loadResource
(String path, int unitSize) Loads and scales a resource file.private static BufferedImage[]
loadResource
(String path, int unitSize, int numOfSprite) Loads a certain number of resources into an array.private static void
loadTileImage
(int unitSize) Loads all tiles' textures.private static void
loadZombieImage
(int unitSize) Loads all zombie's sprites.private static BufferedImage
scaleImage
(BufferedImage image, int unitSize) Scales the given image into the given unit size.
-
Field Details
-
tileMap
The list of all tiles that can be used in the game. -
downImage
The list of player's sprites when moving down. -
upImage
The list of player's sprites when moving up. -
rightImage
The list of player's sprites when moving to the right. -
leftImage
The list of player's sprites when moving to the left. -
downSwimmingImage
The player's sprite when swimming to down. -
upSwimmingImage
The player's sprite when swimming to up. -
rightSwimmingImage
The player's sprite when swimming to the right. -
leftSwimmingImage
The player's sprite when swimming to the left. -
slimeImage
The list of slime's sprites. -
ghostImage
The list of ghost's sprites. -
zombieDownImage
The list of zombie's sprites when moving down. -
zombieUpImage
The list of zombie's sprites when moving up. -
zombieRightImage
The list of zombie's sprites when moving to the right. -
zombieLeftImage
The list of zombie's sprites when moving to the left. -
emptyHeartImage
An empty heart image that is used for the HUD. -
fullHeartImage
An full heart image that is used for the HUD. -
halfHeartImage
An half-empty heart image that is used for the HUD. -
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 theRenderer
-
loadZombieImage
private static void loadZombieImage(int unitSize) Loads all zombie's sprites.- Parameters:
unitSize
- the unit size of theRenderer
-
loadHeartImage
private static void loadHeartImage(int unitSize) Loads all of the heart's images.- Parameters:
unitSize
- the unit size of theRenderer
-
loadPlayerImage
private static void loadPlayerImage(int unitSize) Loads all player's sprites.- Parameters:
unitSize
- the unit size of theRenderer
-
loadTileImage
private static void loadTileImage(int unitSize) Loads all tiles' textures.- Parameters:
unitSize
- the unit size of theRenderer
-
loadResource
Loads a certain number of resources into an array.- Parameters:
path
- the path of the resourcesunitSize
- the unit size of theRenderer
numOfSprite
- the number of sprites to load- Returns:
- the array of loaded resources
-
loadResource
Loads and scales a resource file.- Parameters:
path
- the path of the resourceunitSize
- the unit size of theRenderer
- Returns:
- the loaded and scaled image
-
scaleImage
Scales the given image into the given unit size.- Parameters:
image
- the given imageunitSize
- the given unit size- Returns:
- the scaled image
-