public class GGTileMap
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
java.awt.Point |
getCenter(Location loc)
Returns the current center of tile at given map location with respect
to the playground coordinate system (origin at upper left vertex,
x-coordinate to the left, y-coordinate downwards).
|
int |
getHeigth()
Returns total height (in pixels units) of the tile map.
|
int |
getNbHorzTiles()
Returns the number of horizontal tiles.
|
int |
getNbVertTiles()
Returns the number of vertical tiles.
|
java.awt.Point |
getPosition()
Returns current position of upper left vertex with respect to the
playground coordinate system (origin at upper left vertex, x-coordinate to the left,
y-coordinate downwards).
|
java.awt.Point |
getUpperLeftVertex(Location loc)
Returns the current coordinates of the upper left vertex of tile at given
map location with respect to the playground coordinate system (origin
at upper left vertex, x-coordinate to the left, y-coordinate downwards).
|
int |
getWidth()
Returns total width (in pixels units) of the tile map.
|
boolean |
isTileCollisionEnabled(Location location)
Returns true, if collision notification with the given tiles is enabled.
|
void |
setCollisionCircle(Location location,
java.awt.Point center,
int radius)
Selects the circle (in pixel units) relative to the tile center that is used for
collision detection.
|
void |
setCollisionLine(Location location,
java.awt.Point startPoint,
java.awt.Point endPoint)
Selects the line segment (in pixel units) relative to the tile that is used for
collision detection.
|
void |
setCollisionRectangle(Location location,
java.awt.Point center,
int width,
int height)
Selects the rectangle (in pixel units) relative to the tile that is used for
collision detection.
|
void |
setCollisionSpot(Location location,
java.awt.Point spot)
Selects the hot spot relative to the sprite image that is used for
collision detection.
|
void |
setImage(java.lang.String imagePath,
int horz,
int vert)
Sets the tile image of the tile with given indices.
|
void |
setImage(java.lang.String imagePath,
Location location)
Sets the tile image of the tile with given map location.In order the image
fits exactly on the tile, its size in number of pixels should be
tileHeight x tileWidth given when constructing the tile map.
|
void |
setPosition(java.awt.Point point)
Sets the current position of the upper left vertex with respect to the
playground coordinate system (origin at upper left vertex, x-coordinate to the left,
y-coordinate downwards).
|
void |
setTileCollisionEnabled(Location location,
boolean enable)
Enable/disable the detection of collisions with the given tile.
|
public void setImage(java.lang.String imagePath, int horz, int vert)
imagePath
- the path to the image file; null if the tile is invisiblehorz
- the horizontal tile index in the range 0..nbHorzTiles-1vert
- the vertical tile index in the range 0..nbVertTiles-1public void setImage(java.lang.String imagePath, Location location)
imagePath
- the path to the image file; null if the tile is invisiblelocation
- the location of the tile within the map (0..nbHorzTiles-1, 0..nbVertTiles1)public int getNbHorzTiles()
public int getNbVertTiles()
public int getWidth()
public int getHeigth()
public java.awt.Point getPosition()
public void setPosition(java.awt.Point point)
point
- the new (ulx, uly)public java.awt.Point getUpperLeftVertex(Location loc)
loc
- the tile location within the map (0..nbHorzTiles-1, 0..nbVertTiles-1)public java.awt.Point getCenter(Location loc)
loc
- the tile location within the map (0..nbHorzTiles-1, 0..nbVertTiles-1)public void setTileCollisionEnabled(Location location, boolean enable)
location
- the tile location within the tile mapenable
- if true, collisions will be notifiedpublic boolean isTileCollisionEnabled(Location location)
location
- the tile location within the tile mappublic void setCollisionRectangle(Location location, java.awt.Point center, int width, int height)
location
- to location of the tile within the tile mapcenter
- the rectangle center (zero at tile center)width
- the width in pixel units of the rectangle (in x-direction)height
- the height in pixel units of the rectangle (in y-direction)public void setCollisionCircle(Location location, java.awt.Point center, int radius)
location
- to location of the tile within the tile mapcenter
- circle center (zero at tile center)radius
- the radius of the circle (in pixel units)public void setCollisionLine(Location location, java.awt.Point startPoint, java.awt.Point endPoint)
location
- to location of the tile within the tile mapstartPoint
- the start point of the line (zero at image center)endPoint
- the end point of the line (zero at image center)public void setCollisionSpot(Location location, java.awt.Point spot)
location
- to location of the tile within the tile mapspot
- the hot spot (zero at image center)