Class in reactor_core_display.js

Tilemap

70 functions in 6 groups · hide internal

The Database: everything Core loads at boot.

Familiar territory. Tilemap keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.

The tilemap which displays 2D tile-based game map.

@class
@extends
PIXI.Container
function Tilemap()

Quick Reference

Setup & Creation 4

initialize() Sets up a new instance.
_prepareV8Frame() Prepare v8 frame.
_createLayers() Creates the layers.
makeAutotileId() Makes the autotile id.

Getting Information 2

getAutotileKind() Gets the autotile kind.
getAutotileShape() Gets the autotile shape.

Checks (True / False) 23

isReady() Checks whether the tileset is ready to render.
_isHigherTile() Whether it is higher tile.
_isTableTile() Whether it is table tile.
_isOverpassPosition() Whether it is overpass position.
isVisibleTile() Whether it is visible tile.
isAutotile() Whether it is autotile.
isSameKindTile() Whether it is same kind tile.
isTileA1() Whether it is tile a1.
isTileA2() Whether it is tile a2.
isTileA3() Whether it is tile a3.
isTileA4() Whether it is tile a4.
isTileA5() Whether it is tile a5.
isWaterTile() Whether it is water tile.
isWaterfallTile() Whether it is waterfall tile.
isGroundTile() Whether it is ground tile.
isShadowingTile() Whether it is shadowing tile.
isRoofTile() Whether it is roof tile.
isWallTopTile() Whether it is wall top tile.
isWallSideTile() Whether it is wall side tile.
isWallTile() Whether it is wall tile.
isFloorTypeAutotile() Whether it is floor type autotile.
isWallTypeAutotile() Whether it is wall type autotile.
isWaterfallTypeAutotile() Whether it is waterfall type autotile.

Actions 12

destroy() Destroys the tilemap.
setData() Sets the tilemap data.
setBitmaps() Sets the bitmaps used as a tileset.
_addAllSpots() Adds the all spots.
_addSpot() Adds the spot.
_addSpotTile() Adds the spot tile.
_addTile() Adds the tile.
setTileAnimation() Tile animation a tileset sets out (an RPG Maker 2000/2003 import): frames maps a tile id to the ids it shows…
_addNormalTile() Adds the normal tile.
_addAutotile() Adds the autotile.
_addTableEdge() Adds the table edge.
_addShadow() Adds the shadow.

Updating & Drawing 6

update() Updates the tilemap for each frame.
_syncV8TileLayers() Sync v8 tile layers.
refresh() Forces to repaint the entire tilemap.
updateTransform() Updates the transform on all children of this container for rendering.
_updateBitmaps() Updates the bitmaps each frame.
Renderer() Renderer.

Other 23

_rrChunksSkipped() Rr chunks skipped.
CombinedLayer() Combined layer.
_rrChunkBlocker() Why this frame keeps the full paint, or null when it paints in chunks.
ChunkRecorder() Collects one chunk's rects as the painting hooks hand them to a layer, with the water motion _addAutotile mar…
_rrEnterChunks() Rr enter chunks.
_rrLeaveChunks() Rr leave chunks.
_rrDestroyChunkPart() Rr destroy chunk part.
_rrResetChunks() Every block goes back to the pool: the tileset, the map or its flags changed, or refresh() was called.
_rrChunksStale() Rr chunks stale.
_rrChunkKey() Rr chunk key.
_rrPaintChunks() Paints this frame in chunks; false (after handing back to the full paint) when that fails.
_rrShowChunk() Rr show chunk.
_rrReleaseChunk() Rr release chunk.
_rrBuildChunk() Paints one block through the painting hooks, into recorders standing in for the canonical layers, at water fr…
_rrChunkPart() One layer's mesh of a block, from its recorder: reuses the part it had or a pooled one.
_rrAnimateChunk() The water frame on a block's animated quads: water slides along x, falls along y.
_rrChunkSnapshot() The map data a block was painted from: layers 0-4 of its tiles and of the row above (table edges).
_rrChunkChanged() Rr chunk changed.
_rrKeepUsedTileFrames() The animated tiles the map shows now.
_readMapData() Read map data.
_sortChildren() Sort children.
_compareChildOrder() Compare child order.
Layer() Layer.

Setup & Creation

initialize

method source
Tilemap.prototype.initialize()

Sets up a new instance. (Same as the RPG Maker MZ method of this name.)

_prepareV8Frame

method internal source
Tilemap.prototype._prepareV8Frame()

Prepare v8 frame. (Same as the RPG Maker MZ method of this name.)

_createLayers

method internal source
Tilemap.prototype._createLayers()

Creates the layers. (Same as the RPG Maker MZ method of this name.)

makeAutotileId

static source
Tilemap.makeAutotileId(kind, shape)

Makes the autotile id. (Same as the RPG Maker MZ method of this name.)

Getting Information

getAutotileKind

static source
Tilemap.getAutotileKind(tileId)

Gets the autotile kind. (Same as the RPG Maker MZ method of this name.)

getAutotileShape

static source
Tilemap.getAutotileShape(tileId)

Gets the autotile shape. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isReady

method source
Tilemap.prototype.isReady()

Checks whether the tileset is ready to render.

Details

Checks whether the tileset is ready to render.

@type
boolean
@returns
boolean True if the tilemap is ready.

_isHigherTile

method internal source
Tilemap.prototype._isHigherTile(tileId)

Whether it is higher tile. (Same as the RPG Maker MZ method of this name.)

_isTableTile

method internal source
Tilemap.prototype._isTableTile(tileId)

Whether it is table tile. (Same as the RPG Maker MZ method of this name.)

_isOverpassPosition

method internal source
Tilemap.prototype._isOverpassPosition(/*mx, my*/)

Whether it is overpass position. (Same as the RPG Maker MZ method of this name.)

isVisibleTile

static source
Tilemap.isVisibleTile(tileId)

Whether it is visible tile. (Same as the RPG Maker MZ method of this name.)

isAutotile

static source
Tilemap.isAutotile(tileId)

Whether it is autotile. (Same as the RPG Maker MZ method of this name.)

isSameKindTile

static source
Tilemap.isSameKindTile(tileID1, tileID2)

Whether it is same kind tile. (Same as the RPG Maker MZ method of this name.)

isTileA1

static source
Tilemap.isTileA1(tileId)

Whether it is tile a1. (Same as the RPG Maker MZ method of this name.)

isTileA2

static source
Tilemap.isTileA2(tileId)

Whether it is tile a2. (Same as the RPG Maker MZ method of this name.)

isTileA3

static source
Tilemap.isTileA3(tileId)

Whether it is tile a3. (Same as the RPG Maker MZ method of this name.)

isTileA4

static source
Tilemap.isTileA4(tileId)

Whether it is tile a4. (Same as the RPG Maker MZ method of this name.)

isTileA5

static source
Tilemap.isTileA5(tileId)

Whether it is tile a5. (Same as the RPG Maker MZ method of this name.)

isWaterTile

static source
Tilemap.isWaterTile(tileId)

Whether it is water tile. (Same as the RPG Maker MZ method of this name.)

isWaterfallTile

static source
Tilemap.isWaterfallTile(tileId)

Whether it is waterfall tile. (Same as the RPG Maker MZ method of this name.)

isGroundTile

static source
Tilemap.isGroundTile(tileId)

Whether it is ground tile. (Same as the RPG Maker MZ method of this name.)

isShadowingTile

static source
Tilemap.isShadowingTile(tileId)

Whether it is shadowing tile. (Same as the RPG Maker MZ method of this name.)

isRoofTile

static source
Tilemap.isRoofTile(tileId)

Whether it is roof tile. (Same as the RPG Maker MZ method of this name.)

isWallTopTile

static source
Tilemap.isWallTopTile(tileId)

Whether it is wall top tile. (Same as the RPG Maker MZ method of this name.)

isWallSideTile

static source
Tilemap.isWallSideTile(tileId)

Whether it is wall side tile. (Same as the RPG Maker MZ method of this name.)

isWallTile

static source
Tilemap.isWallTile(tileId)

Whether it is wall tile. (Same as the RPG Maker MZ method of this name.)

isFloorTypeAutotile

static source
Tilemap.isFloorTypeAutotile(tileId)

Whether it is floor type autotile. (Same as the RPG Maker MZ method of this name.)

isWallTypeAutotile

static source
Tilemap.isWallTypeAutotile(tileId)

Whether it is wall type autotile. (Same as the RPG Maker MZ method of this name.)

isWaterfallTypeAutotile

static source
Tilemap.isWaterfallTypeAutotile(tileId)

Whether it is waterfall type autotile. (Same as the RPG Maker MZ method of this name.)

Actions

destroy

method source
Tilemap.prototype.destroy()

Destroys the tilemap.

setData

method source
Tilemap.prototype.setData(width, height, data)

Sets the tilemap data.

Details

Sets the tilemap data.

@param
width number The width of the map in number of tiles.
@param
height number The height of the map in number of tiles.
@param
data array The one dimensional array for the map data.

setBitmaps

method source
Tilemap.prototype.setBitmaps(bitmaps)

Sets the bitmaps used as a tileset.

Details

Sets the bitmaps used as a tileset.

@param
bitmaps array The array of the tileset bitmaps.

_addAllSpots

method internal source
Tilemap.prototype._addAllSpots(startX, startY)

Adds the all spots. (Same as the RPG Maker MZ method of this name.)

_addSpot

method internal source
Tilemap.prototype._addSpot(startX, startY, x, y)

Adds the spot. (Same as the RPG Maker MZ method of this name.)

_addSpotTile

method internal source
Tilemap.prototype._addSpotTile(tileId, dx, dy)

Adds the spot tile. (Same as the RPG Maker MZ method of this name.)

_addTile

method internal source
Tilemap.prototype._addTile(layer, tileId, dx, dy)

Adds the tile. (Same as the RPG Maker MZ method of this name.)

setTileAnimation

method source
Tilemap.prototype.setTileAnimation(frames, water)

Tile animation a tileset sets out (an RPG Maker 2000/2003 import): frames maps a tile id to the ids it shows in turn, a frame every 6 game frames; water gives the water's step in frames and its cycle (4: frames 1-2-3-2, 3: 1-2-3).

Details

Tile animation a tileset sets out (an RPG Maker 2000/2003 import): frames maps a tile id to the ids it shows in turn, a frame every 6 game frames; water gives the water's step in frames and its cycle (4: frames 1-2-3-2, 3: 1-2-3). Only tiles the map uses are kept, so a map without them never repaints for them.

_addNormalTile

method internal source
Tilemap.prototype._addNormalTile(layer, tileId, dx, dy)

Adds the normal tile. (Same as the RPG Maker MZ method of this name.)

_addAutotile

method internal source
Tilemap.prototype._addAutotile(layer, tileId, dx, dy)

Adds the autotile. (Same as the RPG Maker MZ method of this name.)

_addTableEdge

method internal source
Tilemap.prototype._addTableEdge(layer, tileId, dx, dy)

Adds the table edge. (Same as the RPG Maker MZ method of this name.)

_addShadow

method internal source
Tilemap.prototype._addShadow(layer, shadowBits, dx, dy)

Adds the shadow. (Same as the RPG Maker MZ method of this name.)

Updating & Drawing

update

method source
Tilemap.prototype.update()

Updates the tilemap for each frame.

_syncV8TileLayers

method internal source
Tilemap.prototype._syncV8TileLayers()

Sync v8 tile layers. (Same as the RPG Maker MZ method of this name.)

refresh

method source
Tilemap.prototype.refresh()

Forces to repaint the entire tilemap.

updateTransform

method source
Tilemap.prototype.updateTransform()

Updates the transform on all children of this container for rendering.

_updateBitmaps

method internal source
Tilemap.prototype._updateBitmaps()

Updates the bitmaps each frame. (Same as the RPG Maker MZ method of this name.)

Renderer

static source
Tilemap.Renderer()

Renderer. (Same as the RPG Maker MZ method of this name.)

Other

_rrChunksSkipped

method internal source
Tilemap.prototype._rrChunksSkipped()

Rr chunks skipped. (Same as the RPG Maker MZ method of this name.)

CombinedLayer

static source
Tilemap.CombinedLayer()

Combined layer. (Same as the RPG Maker MZ method of this name.)

_rrChunkBlocker

method internal source
Tilemap.prototype._rrChunkBlocker()

Why this frame keeps the full paint, or null when it paints in chunks.

ChunkRecorder

static source
Tilemap.ChunkRecorder(tilemap)

Collects one chunk's rects as the painting hooks hand them to a layer, with the water motion _addAutotile marks them with.

_rrEnterChunks

method internal source
Tilemap.prototype._rrEnterChunks()

Rr enter chunks. (Same as the RPG Maker MZ method of this name.)

_rrLeaveChunks

method internal source
Tilemap.prototype._rrLeaveChunks()

Rr leave chunks. (Same as the RPG Maker MZ method of this name.)

_rrDestroyChunkPart

method internal source
Tilemap.prototype._rrDestroyChunkPart(part)

Rr destroy chunk part. (Same as the RPG Maker MZ method of this name.)

_rrResetChunks

method internal source
Tilemap.prototype._rrResetChunks(state)

Every block goes back to the pool: the tileset, the map or its flags changed, or refresh() was called.

_rrChunksStale

method internal source
Tilemap.prototype._rrChunksStale(state)

Rr chunks stale. (Same as the RPG Maker MZ method of this name.)

_rrChunkKey

static internal source
Tilemap._rrChunkKey(cx, cy)

Rr chunk key. (Same as the RPG Maker MZ method of this name.)

_rrPaintChunks

method internal source
Tilemap.prototype._rrPaintChunks(startX, startY)

Paints this frame in chunks; false (after handing back to the full paint) when that fails.

_rrShowChunk

method internal source
Tilemap.prototype._rrShowChunk(chunk, shown)

Rr show chunk. (Same as the RPG Maker MZ method of this name.)

_rrReleaseChunk

method internal source
Tilemap.prototype._rrReleaseChunk(state, chunk)

Rr release chunk. (Same as the RPG Maker MZ method of this name.)

_rrBuildChunk

method internal source
Tilemap.prototype._rrBuildChunk(state, cx, cy, now)

Paints one block through the painting hooks, into recorders standing in for the canonical layers, at water frame 0, and makes its meshes.

Details

Paints one block through the painting hooks, into recorders standing in for the canonical layers, at water frame 0, and makes its meshes. now: the view needs it this frame (shown at once).

_rrChunkPart

method internal source
Tilemap.prototype._rrChunkPart(state, part, recorder, root, left, top)

One layer's mesh of a block, from its recorder: reuses the part it had or a pooled one.

_rrAnimateChunk

method internal source
Tilemap.prototype._rrAnimateChunk(state, chunk)

The water frame on a block's animated quads: water slides along x, falls along y.

_rrChunkSnapshot

method internal source
Tilemap.prototype._rrChunkSnapshot(chunk, into)

The map data a block was painted from: layers 0-4 of its tiles and of the row above (table edges).

_rrChunkChanged

method internal source
Tilemap.prototype._rrChunkChanged(chunk)

Rr chunk changed. (Same as the RPG Maker MZ method of this name.)

_rrKeepUsedTileFrames

method internal source
Tilemap.prototype._rrKeepUsedTileFrames()

The animated tiles the map shows now.

Details

The animated tiles the map shows now. A tile changed after load (a substitution, then refresh) is asked for again.

_readMapData

method internal source
Tilemap.prototype._readMapData(x, y, z)

Read map data. (Same as the RPG Maker MZ method of this name.)

_sortChildren

method internal source
Tilemap.prototype._sortChildren()

Sort children. (Same as the RPG Maker MZ method of this name.)

_compareChildOrder

method internal source
Tilemap.prototype._compareChildOrder(a, b)

Compare child order. (Same as the RPG Maker MZ method of this name.)

Layer

static source
Tilemap.Layer()

Layer. (Same as the RPG Maker MZ method of this name.)