Creates an instance of IsoTilemap.
3/14/2023 - 2:14:31 PM
angle = CLASSIC, clamp = true, ...config }
Protected
Readonly
angleIsometric projection angle, defaults to CLASSIC
. Other angles are exported as ISOMETRIC, MILITARY
3/14/2023 - 2:14:31 PM
Protected
Readonly
angleThe cosign of the angle
3/14/2023 - 2:14:31 PM
Protected
Readonly
angleThe sine of the angle
3/14/2023 - 2:14:31 PM
Protected
Readonly
baseThe tile offset coordinates given the base dimensions and origin
3/14/2023 - 2:14:31 PM
Protected
Readonly
baseThe middle point of the top surface, (height - depth) / 2
3/14/2023 - 2:14:31 PM
Protected
Readonly
baseThe height of the top surface of the tile, height - depth
3/14/2023 - 2:14:31 PM
Protected
baseDescription placeholder
3/14/2023 - 12:44:55 PM
Protected
Readonly
baseDescription placeholder
3/14/2023 - 12:44:55 PM
Protected
Readonly
boundsContains the lower and upper bounds of the map's z, x, y axes using tile coordinates
3/14/2023 - 12:44:55 PM
Protected
Readonly
clampWhether or not to clamp values
3/14/2023 - 2:14:31 PM
Protected
getDescription placeholder
3/14/2023 - 12:44:55 PM
Protected
getProtected
getProtected
Readonly
mapContains references to T values using their tile coordinates for three-dimensional map indices, z -> x -> y
3/14/2023 - 12:44:55 PM
Readonly
tileA three-dimensional map of boxes containing references to tiles, with world coordinations and dimensions of placed tiles
3/14/2023 - 2:14:31 PM
Protected
Readonly
worldDescription placeholder
3/14/2023 - 12:44:55 PM
Protected
baseProtected
_getProtected
_projectProtected
_unprojectAdd a tile to the tilemap at a given coordinate, optionally providing different tile dimensions if the tile is a different size than the base scale. The returned coordinate is relative to the world origin.
3/14/2023 - 12:44:55 PM
A point at which to place this tile relative to the world origin
const T = {}
const { x, y, z } = isoTilemap.add(T, { x: 1, y: 1, z: 0 })
sprite.position.x = x
sprite.position.y = y
sprite.zIndex = z
map.get({ x: 1, y: 1, z: 0 }) === T // true
The value to store at provided map coordinates
The map tile coordinates to store the provided
Optional
dimensions: IRectangle3 = ...Alternate dimensions to use instead of the base tile dimensions
Optional
origin: IPoint = ...Alterate origin with which to place tile if different from base origin
Return the first visible tile that collides with a projected world coordinate. Starts at highest z and scans tiles along a ray to the lowest z. Optionally takes a callback with the backing value and tile coordinates to include in the ray's path
3/14/2023 - 2:14:30 PM
const foo = map.add('foo', { x: 0, y: 0, z: 0 })
const bar = map.add('bar', { x: 1, y: 1, z: 1 })
castRay({ x: 400, y: 400 }) === bar
Returns a world offset position where the centermost tile is centered to the viewport
3/14/2023 - 12:44:55 PM
const mapContainer = new PIXI.Container()
const worldPosition = tilemap.center()
mapContainer.x = worldPosition.x
mapCOntainer.y = worldPosition.y
Returns a world offset position where the given screen space coordinate is centered to the viewport
3/14/2023 - 12:44:55 PM
const mapContainer = new PIXI.Container()
const worldPosition = tilemap.centerToPoint({ x: 500, y: 200 })
mapContainer.x = worldPosition.x
mapCOntainer.y = worldPosition.y
Returns the new world position where the given tile is in the center of the viewport.
3/14/2023 - 12:44:55 PM
const mapContainer = new PIXI.Container()
const worldPosition = tilemap.centerToTile({ x: 1, y: 1, z: 0 })
mapContainer.x = worldPosition.x
mapCOntainer.y = worldPosition.y
The tile coordinates to center
Returns a three-dimensional map of all tiles that collide with a projected world coordinate Optionally takes a callback with the backing value and tile coordinates to include in the ray's path
3/14/2023 - 2:14:30 PM
const foo = map.add('foo', { x: 0, y: 0, z: 0 })
const bar = map.add('bar', { x: 1, y: 1, z: 1 })
hits({ x: 400, y: 400 }) === Map{ 0: Map{ 0: Map{ 0: foo } }, 1: Map{ 1: Map{ 1: bar } } }
Get a single tile at given map coordinates
3/14/2023 - 12:44:55 PM
The tile at given coordinates
const tile = tilemap.get({ x: 1, y: 1, z: 1 })
Map tile coordinates. If no z is provided, it defaults to 0.
Get an array of tile dimensions from a map at given x,y coordinates, from ascending z index
3/14/2023 - 2:36:28 PM
const [...boxDimensions] = tilemap.getDimensionsColumn({ x: 1, y: 1 })
Moves a tile from given coordinate to another coordinate
3/14/2023 - 12:44:55 PM
A point at which to place the moved tile relative to the world origin
const { x, y, z } = tilemap.move({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 0 })
sprite.position.x = x
sprite.position.y = y
sprite.zIndex = z
The map coordinates of the tile to move
The map coordinates to move the tile to
Optional
dimensions: IRectangle = ...The dimensions of the tile, defaults to this.baseTileDimensions
Optional
origin: IPoint = ...The origin point of the tile, defaults to this.baseTileOrigin
Optional
fallback: TProtected
recalculateProject a tile coordinate to an absolute screen space coordinate relative to the window, taking world offset / scale into account
3/14/2023 - 12:44:55 PM
Screen space point
const { x, y } = map.toScreenPoint({ x: 0, y: 0, z: 0 });
debugGraphics.lineStyle(2, 0xff00ff, 1);
debugGraphics.drawRect(
x - 32 * mapContainer.scale.x,
y - 32 * mapContainer.scale.y,
64 * mapContainer.scale.x,
32 * mapContainer.scale.y
);
The tile coordinates
Optional
dimensions: IRectangle3 = ...The dimensions of the tile, defaults to this.baseTileDimensions
Optional
origin: IPoint = ...The origin point of the tile, defaults to this.baseTileOrigin
Project a tile coordinate to a world coordinate, not taking world offset / scale into account
3/14/2023 - 12:44:55 PM
World space point
The tile coordinates
Optional
dimensions: IRectangle3 = ...The dimensions of the tile, defaults to this.baseTileDimensions
Optional
origin: IPoint = ...The origin point of the tile, defaults to this.baseTileOrigin
Project a world coordinate to a tile coordinate, not taking world offset / scale into account.
3/14/2023 - 12:44:55 PM
tile coordinate
const tileCoord = tileMap.worldToTile(transformGlobalEventToWorldCoordinates({ x: e.offsetX, y: e.offsetY }))
const tileCoord = tileMap.worldToTile({ x: 400, y: 300 })
The world coordinates
Optional
dimensions: IRectangle3 = ...The dimensions of the tile, defaults to this.baseTileDimensions
Optional
origin: IPoint = ...The origin point of the tile, defaults to this.baseTileOrigin
Generated using TypeDoc
Class that extends basic 2D Tilemap functionality based on given projectionAngle.
Date
3/14/2023 - 2:14:31 PM
Export