Create a Tilemap<T>
instance.
3/14/2023 - 12:44:55 PM
worldOrigin, baseTileOrigin, baseTileDimensions, getScreenDimensions, getWorldPosition, getWorldScale, }
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
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
Protected
Readonly
worldDescription placeholder
3/14/2023 - 12:44:55 PM
Protected
_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
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
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.
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
Description placeholder
Date
3/14/2023 - 12:44:55 PM
Export