|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectse.liu.student.kimgr905.tilegame.TileGameResourceManager
public final class TileGameResourceManager
The ResourceManager class loads and manages "host" Sprites used in the game. Game Sprites are cloned from "host" Sprites.
It also loads the TileMap from a textfile. As well as provides methods for converting tile and pixel positions.
| Field Summary | |
|---|---|
private Sprite |
biglazerSprite
|
private Sprite |
boss1Sprite
|
private Sprite |
bossAimedSprite
|
private Sprite |
bossCannonSprite
|
private Sprite |
bossLazerSprite
|
private int |
currentMap
|
private Sprite |
droneSprite
|
private Sprite |
dualShotSprite
|
private Sprite |
minilazerSprite
|
private Sprite |
playerShotSprite
|
private Sprite |
playerSprite
|
private Sprite |
shieldSprite
|
private static int |
TILE_SIZE_BITS
|
private Sprite |
weaponSprite
|
| Constructor Summary | |
|---|---|
TileGameResourceManager()
Creates a new ResourceManager. |
|
| Method Summary | |
|---|---|
void |
addBossShot(TileMap map,
Ship ship)
Adds bosshots to the TileMap. |
void |
addPlayerShot(TileMap map,
Player player)
Adds playershots to the TileMap. |
private static void |
addSprite(TileMap map,
Sprite hostSprite,
int tileX,
int tileY)
Adds and centers a sprite on the TileMap. |
private Animation |
createAimedShotAnim()
|
private Animation |
createBiglazerAnim()
|
private Animation |
createBoss1ExplodingAnim()
|
private Animation |
createBossAnim()
|
private Animation |
createCannonShotAnim()
|
private Animation |
createDroneAnim()
|
private Animation |
createDualShotAnim()
|
private Animation |
createExplodingAnim()
|
private Animation |
createLazerShotAnim()
|
private Animation |
createMinilazerAnim()
|
private Animation |
createPlayerAnim()
|
private Animation |
createShotAnim()
|
java.net.URL |
getResource(java.lang.String filename)
|
private void |
loadCreatureSprites()
Code for loading sprites and images |
java.awt.Image |
loadImage(java.lang.String name)
Returns the image "name" from images/"name" as an ImageIcon. |
private TileMap |
loadMap(java.lang.String filename,
int screenHeight)
Loads a TileMap based on the filename given. |
TileMap |
loadNextMap(int screenHeight)
Load the next map. |
private void |
loadPowerUpSprites()
|
private static int |
pixelsToTiles(int pixels)
Converts a pixel position to a tile position. |
TileMap |
reloadMap(int screenHeight)
Reloads the current map. |
private static int |
tilesToPixels(int numTiles)
Converts a tile position to a pixel position. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int TILE_SIZE_BITS
private int currentMap
private Sprite playerSprite
private Sprite biglazerSprite
private Sprite droneSprite
private Sprite minilazerSprite
private Sprite weaponSprite
private Sprite shieldSprite
private Sprite boss1Sprite
private Sprite playerShotSprite
private Sprite dualShotSprite
private Sprite bossCannonSprite
private Sprite bossLazerSprite
private Sprite bossAimedSprite
| Constructor Detail |
|---|
public TileGameResourceManager()
| Method Detail |
|---|
private static int tilesToPixels(int numTiles)
numTiles - tile position
private static int pixelsToTiles(int pixels)
pixels - pixel position
public java.awt.Image loadImage(java.lang.String name)
name - file name
public java.net.URL getResource(java.lang.String filename)
public TileMap loadNextMap(int screenHeight)
screenHeight - height of the screen in pixels
public TileMap reloadMap(int screenHeight)
screenHeight - height of the screen in pixels
public void addPlayerShot(TileMap map,
Player player)
map - TileMapplayer - the player
public void addBossShot(TileMap map,
Ship ship)
map - TileMapship - the boss
private TileMap loadMap(java.lang.String filename,
int screenHeight)
throws java.io.IOException
filename - a filenamescreenHeight - the height of the screen in pixels
java.io.IOException
private static void addSprite(TileMap map,
Sprite hostSprite,
int tileX,
int tileY)
map - TileMaphostSprite - the sprite to clone fromtileX - tile x-positiontileY - tile y-positionprivate void loadCreatureSprites()
private Animation createBoss1ExplodingAnim()
private Animation createBossAnim()
private Animation createPlayerAnim()
private Animation createBiglazerAnim()
private Animation createDroneAnim()
private Animation createShotAnim()
private Animation createDualShotAnim()
private Animation createLazerShotAnim()
private Animation createCannonShotAnim()
private Animation createAimedShotAnim()
private Animation createMinilazerAnim()
private Animation createExplodingAnim()
private void loadPowerUpSprites()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||