Class MapOrientations
public class MapOrientations
extends java.lang.Object
Field Summary
Fields Modifier and Type Field Description static IMapOrientation
HEXAGONAL
A hexagonalIMapOrientation
, consistent with the behavior of Tiled.static IMapOrientation
ISOMETRIC
An isometricIMapOrientation
, consistent with the behavior of Tiled.static IMapOrientation
ISOMETRIC_STAGGERED
A staggered isometricIMapOrientation
, consistent with the behavior of Tiled.static IMapOrientation
ORTHOGONAL
AnIMapOrientation
for orthogonal maps, consistent with the behavior of Tiled.Method Summary
Modifier and Type Method Description static IMapOrientation
forName(java.lang.String name)
Determines the appropriateIMapOrientation
instance for the given name.
Field Details
ORTHOGONAL
An
IMapOrientation
for 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
IllegalArgumentException
s 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
IllegalArgumentException
will be thrown. Like the standard isometric orientation, this orientation will also throw anIllegalArgumentException
when 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 appropriateIMapOrientation
instance 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
IMapOrientation
by the given name