public interface MapTile extends SurfaceTile, Featurable
A sheet id represents a tilesheet number (surface number containing tiles). A map can have one or more sheets. The map picks its resources from a sheets folder, which must contains the files images.
MapTileGame
,
Minimap
,
Tile
Modifier and Type | Method and Description |
---|---|
void |
addListener(TileSetListener listener)
Add a tile set listener.
|
void |
append(Collection<MapTile> maps,
int offsetX,
int offsetY,
int randX,
int randY)
Append existing maps.
|
void |
append(MapTile map,
int offsetX,
int offsetY)
Append an existing map, starting at the specified offsets.
|
void |
clear()
Remove all tiles from map and clear internal data.
|
void |
create(int tileWidth,
int tileHeight,
int widthInTile,
int heightInTile)
Create and prepare map memory area.
|
void |
create(Media levelrip)
Create a map from a level rip which should be an image file (*.PNG, *.BMP) that represents the full map.
|
void |
create(Media levelrip,
int tileWidth,
int tileHeight,
int horizontalTiles)
Create a map from a level rip which should be an image file (*.PNG, *.BMP) that represents the full map.
|
void |
create(Media levelrip,
Media sheetsConfig)
Create a map from a level rip and the associated tiles configuration file.
|
Tile |
createTile(Integer sheet,
int number,
double x,
double y)
Create a tile.
|
int |
getInTileHeight()
Get number of vertical tiles.
|
int |
getInTileRadius()
Get the radius in tile.
|
int |
getInTileWidth()
Get number of horizontal tiles.
|
int |
getInTileX(Localizable localizable)
Get location x relative to map referential as tile.
|
int |
getInTileY(Localizable localizable)
Get location y relative to map referential as tile.
|
Collection<Tile> |
getNeighbors(Tile tile)
Get the tile neighbor, directly adjacent to it.
|
SpriteTiled |
getSheet(Integer sheet)
Get sheet from its id.
|
Collection<Integer> |
getSheets()
Get list of sheets id.
|
int |
getSheetsNumber()
Get the number of used sheets.
|
Tile |
getTile(int tx,
int ty)
Get tile from specified map location (in tile index).
|
Tile |
getTile(Localizable localizable,
int offsetX,
int offsetY)
Get the tile at the localizable.
|
Tile |
getTileAt(double x,
double y)
Get the tile at the location.
|
Collection<Tile> |
getTilesHit(double ox,
double oy,
double x,
double y)
Get the list of tiles from old location to current.
|
int |
getTilesNumber()
Get number of active tiles (which are not
null ). |
boolean |
isCreated()
Check if map has been created.
|
void |
loadSheets(Collection<SpriteTiled> sheets)
Load map sheets (tiles surfaces).
|
void |
loadSheets(Media sheetsConfig)
Load map sheets (tiles surfaces) from directory.
|
void |
removeListener(TileSetListener listener)
Remove a tile set listener.
|
void |
setTile(Tile tile)
Set a tile at specified map location.
|
getTileHeight, getTileWidth
addFeature, addFeatureAndGet, checkListener, getMedia
getFeature, getFeatures, getFeaturesType, hasFeature
void create(int tileWidth, int tileHeight, int widthInTile, int heightInTile)
setTile(Tile)
).
Previous map data (if existing) will be cleared (clear()
).tileWidth
- The tile width.tileHeight
- The tile height.widthInTile
- The map width in tile (must be strictly positive).heightInTile
- The map height in tile (must be strictly positive).LionEngineException
- If size is invalid.create(Media)
,
create(Media, Media)
void create(Media levelrip, int tileWidth, int tileHeight, int horizontalTiles)
create(int, int, int, int)
).levelrip
- The file describing the levelrip as a single image.tileWidth
- The tile width.tileHeight
- The tile height.horizontalTiles
- The number of horizontal tiles on sheets.LionEngineException
- If error when importing map.TilesExtractor
,
LevelRipConverter
void create(Media levelrip)
create(int, int, int, int)
).
TileSheetsConfig.FILENAME
and TileGroupsConfig.FILENAME
will be used as default, by calling create(Media, Media)
.
levelrip
- The file describing the levelrip as a single image.LionEngineException
- If error when importing map.TilesExtractor
,
LevelRipConverter
void create(Media levelrip, Media sheetsConfig)
create(int, int, int, int)
).levelrip
- The file describing the levelrip as a single image.sheetsConfig
- The file that define the sheets configuration.LionEngineException
- If error when importing map.TilesExtractor
,
LevelRipConverter
Tile createTile(Integer sheet, int number, double x, double y)
sheet
- The sheet number (must be positive or equal to 0).number
- The tile number on sheet (must be positive or equal to 0).x
- The horizontal location.y
- The vertical location.LionEngineException
- If invalid arguments.void loadSheets(Collection<SpriteTiled> sheets)
sheets
- The sheets reference.LionEngineException
- If inconsistent tile size.void loadSheets(Media sheetsConfig)
sheetsConfig
- The file that define the sheets configuration.LionEngineException
- If error when reading sheets.void append(MapTile map, int offsetX, int offsetY)
append(MapTile, int, int)
at (getInTileWidth()
, getInTileHeight()
) will add
the new map at the top-right.map
- The map to append.offsetX
- The horizontal offset in tile (positive).offsetY
- The vertical offset in tile (positive).void append(Collection<MapTile> maps, int offsetX, int offsetY, int randX, int randY)
maps
- The maps to append.offsetX
- The horizontal offset factor in tile (positive).offsetY
- The vertical offset factor in tile (positive).randX
- The horizontal random offset in tile.randY
- The vertical random offset in tile.void clear()
loadSheets(Media)
).void addListener(TileSetListener listener)
listener
- The listener reference.void removeListener(TileSetListener listener)
listener
- The listener reference.void setTile(Tile tile)
The tile location must be between 0 and map size (getInTileWidth()
, getInTileHeight()
).
If a tile exists at the tile location, it will be removed.
tile
- The tile reference.LionEngineException
- If outside map range.Tile getTile(int tx, int ty)
null
, this
means that there is not tile at this location. It is not an error, just a way to avoid useless tile storage.tx
- The horizontal tile index location.ty
- The vertical tile index location.null
if none.Tile getTile(Localizable localizable, int offsetX, int offsetY)
localizable
- The localizable reference.offsetX
- The horizontal offset search.offsetY
- The vertical offset search.null
if none.Tile getTileAt(double x, double y)
x
- The horizontal location.y
- The vertical location.null
if none.Collection<Tile> getNeighbors(Tile tile)
tile
- The tile reference.Collection<Tile> getTilesHit(double ox, double oy, double x, double y)
ox
- The old horizontal location.oy
- The old vertical location.x
- The current horizontal location.y
- The current vertical location.int getInTileX(Localizable localizable)
localizable
- The localizable reference.int getInTileY(Localizable localizable)
localizable
- The localizable reference.Collection<Integer> getSheets()
SpriteTiled getSheet(Integer sheet)
sheet
- The sheet id.LionEngineException
- If sheet not found.int getSheetsNumber()
int getTilesNumber()
null
).null
tile.int getInTileWidth()
int getInTileHeight()
int getInTileRadius()
boolean isCreated()
true
if created, false
else.Copyright © 2017 Byron 3D Games Studio. All rights reserved.