API Docs for:
Show:

Tile Class

Uses
Defined in: src/tile.js:6

Represents a tile in the game map.

Constructor

Tile

(
  • game
  • type
  • x
  • y
)

Defined in src/tile.js:6

Parameters:

  • game Object
    • Game instance this obj is attached to.
  • type String
    • Type of tile. When created this object is merged with the value of Tile.Types[type].
  • x Number
    • The map tile coordinate position of this tile on the x axis.
  • y Number
    • The map tile coordinate position of this tile on the y axis.

Methods

bump

(
  • entity
)

Defined in src/tile.js:141

Handles the behavior of a player or other entity attempting to move into this tile. Only used if this.passable = false.

Parameters:

  • entity Object
    • The player or entity attempting to move into this tile.

getTileDrawData

() TileDrawData

Inherited from TileDraw: src/mixins.js:22

Returns as tileDataobject used by Renderer objects to draw tiles.

Returns:

init

(
  • game
  • type
  • x
  • y
)

Defined in src/tile.js:56

Optional Callback. Called when the entity is first created. Intended to be assigned by Entity.Types.

Parameters:

  • game Game
    • Game instance this obj is attached to.
  • type String
    • Type of tile. When created this object is merged with the value of Tile.Types[type].
  • x Number
    • The map tile coordinate position of this tile on the x axis.
  • y Number
    • The map tile coordinate position of this tile on the y axis.

onEntityEnter

(
  • entity
  • x
  • y
)

Defined in src/tile.js:154

Handles entity entering a new tile. Called after chaning the entities position

Parameters:

  • entity Entity
    • The entity entering the tile
  • x Number
    • Map tile coord.
  • y Number
    • Map tile coord.

Properties

bgColor

String | Bool

Defined in src/tile.js:122

The background color the character displayed when rendering this tile. Not rendered if evaluates to false.

blocksLos

Bool

Defined in src/tile.js:87

If this tile blocks line of sight.

char

String

Defined in src/tile.js:108

The character displayed when rendering this tile.

color

String | Bool

Defined in src/tile.js:115

The color of the character displayed when rendering this tile. Not rendered if evaluates to false.

explored

Bool

Defined in src/tile.js:73

If this tile has been explored by the player.

game

Game

Defined in src/tile.js:35

Game instance this obj is attached to.

name

String

Defined in src/tile.js:66

Display name for this tile.

passable

Bool

Defined in src/tile.js:80

If entities can move through this tile.

type

String

Defined in src/tile.js:48

The type of entity this is. When created this object is merged with the value of Tile.Types[type]. See constructor.

x

Number

Defined in src/tile.js:94

The tile map tile x coord.

y

Number

Defined in src/tile.js:101

The tile map tile y coord.