Class MapOrientations
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IMapOrientationA hexagonalIMapOrientation, consistent with the behavior of Tiled.static final IMapOrientationAn isometricIMapOrientation, consistent with the behavior of Tiled.static final IMapOrientationA staggered isometricIMapOrientation, consistent with the behavior of Tiled.static final IMapOrientationAnIMapOrientationfor orthogonal maps, consistent with the behavior of Tiled. -
Method Summary
Modifier and TypeMethodDescriptionstatic IMapOrientationDetermines the appropriateIMapOrientationinstance for the given name.
-
Field Details
-
ORTHOGONAL
An
IMapOrientationfor orthogonal maps, consistent with the behavior of Tiled.With this orientation, tiles are treated as rectangles with dimensions equal to the tile size, layed out in rows and columns starting with the origin.
-
ISOMETRIC
An isometric
IMapOrientation, consistent with the behavior of Tiled.With this orientation, the shapes of tiles are transformed into an isometric coordinate system via the transformation
(x, y) -> ((x-y)/2, (x+y)/2). Rectangles within this coordinate system are rendered as diamond shapes. Points are also translated such that every tile in a map fits in the first quadrant.This orientation does not transform map objects into its coordinate system. Maps with an odd-numbered tile width or height will throw
IllegalArgumentExceptions when using this orientation. -
ISOMETRIC_STAGGERED
A staggered isometric
IMapOrientation, consistent with the behavior of Tiled.This orientation is similar to the isometric orientation, but the tile coordinates are changed to be arranged in a rectangular area. The locations of tiles are positioned using rectangular coordinates, with tiles with parity on the stagger axis matching the stagger index filling the gaps between the other tiles.
This orientation requires that a stagger axis and stagger index be set. If either are missing, an
IllegalArgumentExceptionwill be thrown. Like the standard isometric orientation, this orientation will also throw anIllegalArgumentExceptionwhen used with a map with an odd-numbered tile width or height. -
HEXAGONAL
A hexagonal
IMapOrientation, consistent with the behavior of Tiled.Tiles are arranged in the same manner as the staggered isometric orientation (the staggered isometric orientation can be viewed as a special case of this orientation with a hex side length of 0), with extra space between tiles (the hex side length) added on the stagger axis to allow for a hexagonal shape.
This orientation has the same requirements as staggered isometric, with the additional restriction that the hex side length must be an even number.
-
-
Method Details
-
forName
Determines the appropriateIMapOrientationinstance for the given name. If no such orientation exists, this method returnsnull.- Parameters:
name- The name of the orientation, as stored in the TMX file- Returns:
- The
IMapOrientationby the given name
-