|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.map.GameMap
org.deken.game.map.TileMap
public class TileMap
Title: TileMap
Description: This tile map is for a game map that not only has width and height, but layers for the game play to occur on. The Layer is the first index in the MapElement array, this allows a layer to be sent to objects that require a MapElement array of width and height. Each entry is stored as a Sprite, so the specific object can be anything that extends the Sprite, thus allowing for animated images.
Copyright: (c) 2007
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.deken.game.map.GameMap |
---|
GameMap.QUEUE |
Field Summary | |
---|---|
protected MapElement[][][] |
tiles
|
Fields inherited from class org.deken.game.map.GameMap |
---|
background, collisionMap, components, layout, mapRenderer, mapSize, updateables |
Constructor Summary | |
---|---|
TileMap(int width,
int height)
Game2DMap Creates a new Game2DMap with the specified width and height (in number of tiles) of the map. |
|
TileMap(int width,
int height,
int layers)
Creates a new Game2DMap with the specified width, height and layers (in number of tiles) of the map. |
|
TileMap(MapSize mapSize)
Creates a new Game2DMap with the specified width, height and layers (in number of tiles) of the map. |
Method Summary | |
---|---|
void |
addSection(Section section,
GameLocation gameLocation)
Add a Section to the specified location. |
void |
addSprite(Sprite sprite,
GameLocation gameLocation)
Adds the Sprite at the specified location, or does not set the tile if the specified location is outside the map. |
Sprite |
addSpriteCopy(Sprite sprite,
GameLocation gameLocation)
Adds the Sprite, as a copy, at the specified location, or does not set the tile if the specified location is outside the map. |
Decor |
addTile(Decor decor,
GameLocation gameLocation)
Adds the Decor (tile) at the specified location, or does not set the tile if the specified location is outside the map. |
Decor |
addTile(Decor decor,
GameLocation gameLocation,
boolean placeHolder,
boolean nonTileCollision)
/** Adds the Decor (tile) at the specified location, or does not set the tile if the specified location is outside the map. |
MapElement[][][] |
getMapElements()
MapElement array, is stored as [Layer][X][Y]. |
Actor |
getPlayer()
Gets the player Sprite. |
java.util.Collection<Sprite> |
getSprites()
Returns the list of all moving sprites. |
java.util.Collection<Sprite> |
getSprites(int z,
int y)
Gets the list of sprites for a given layer (z) and row (y) |
MapElement |
getTile(int x,
int y,
int z)
Gets the Decor at the tile location specified. |
boolean |
removeSprite(Sprite sprite)
|
Decor |
removeTile(GameLocation gameLocation)
|
void |
setCollisionMap(CollisionMap collisionMap)
|
void |
setPlayer(Actor player,
GameLocation gameLocation)
Sets the player Sprite. |
void |
setWrapping(MapWrapping wrapping)
|
void |
update(long elapseTime)
Update the elements in the GameMap. |
Methods inherited from class org.deken.game.map.GameMap |
---|
addComponents, addUpdateable, clearQueueComponents, draw, getActions, getBackground, getComponentByName, getComponents, getLayout, getMapSize, getName, removeComponent, setBackground, setLayout, setMapRenderer, setMapSize, setName, setScreenSize, setupPlayer, updateQueueComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MapElement[][][] tiles
Constructor Detail |
---|
public TileMap(int width, int height)
width
- intheight
- intpublic TileMap(int width, int height, int layers)
width
- intheight
- intlayers
- intpublic TileMap(MapSize mapSize)
mapSize
- MapSizeMethod Detail |
---|
public void addSection(Section section, GameLocation gameLocation)
GameMap
addSection
in class GameMap
section
- SectiongameLocation
- GameLocationpublic void addSprite(Sprite sprite, GameLocation gameLocation)
addSprite
in class GameMap
sprite
- SpritegameLocation
- GameLocationpublic Sprite addSpriteCopy(Sprite sprite, GameLocation gameLocation)
addSpriteCopy
in class GameMap
sprite
- SpritegameLocation
- GameLocation
public Decor addTile(Decor decor, GameLocation gameLocation)
addTile
in class GameMap
decor
- DecorgameLocation
- GameLocation
public Decor addTile(Decor decor, GameLocation gameLocation, boolean placeHolder, boolean nonTileCollision)
addTile
in class GameMap
decor
- gameLocation
- placeHolder
- nonTileCollision
-
public boolean removeSprite(Sprite sprite)
removeSprite
in class GameMap
public Decor removeTile(GameLocation gameLocation)
removeTile
in class GameMap
public MapElement getTile(int x, int y, int z)
getTile
in class GameMap
x
- inty
- intz
- int
public void update(long elapseTime)
GameMap
update
in interface Updateable
update
in class GameMap
elapseTime
- longpublic void setPlayer(Actor player, GameLocation gameLocation)
GameMap
setPlayer
in class GameMap
player
- ActorgameLocation
- GameLocationpublic MapElement[][][] getMapElements()
public Actor getPlayer()
GameMap
getPlayer
in class GameMap
public java.util.Collection<Sprite> getSprites()
GameMap
getSprites
in class GameMap
public java.util.Collection<Sprite> getSprites(int z, int y)
TileMapRender
getSprites
in interface TileMapRender
public void setCollisionMap(CollisionMap collisionMap)
setCollisionMap
in class GameMap
collisionMap
- CollisionMappublic void setWrapping(MapWrapping wrapping)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |