Tile Class
Represents a tile in the game map.
Constructor
Tile
-
game -
type -
x -
y
Parameters:
-
gameObject- Game instance this obj is attached to.
-
typeString- Type of tile. When created this object is merged with the value of Tile.Types[type].
-
xNumber- The map tile coordinate position of this tile on the x axis.
-
yNumber- The map tile coordinate position of this tile on the y axis.
Item Index
Methods
Methods
bump
-
entity
Handles the behavior of a player or other entity attempting to move into this tile. Only used if this.passable = false.
Parameters:
-
entityObject- The player or entity attempting to move into this tile.
getTileDrawData
()
TileDrawData
Returns as tileDataobject used by Renderer objects to draw tiles.
Returns:
init
-
game -
type -
x -
y
Optional Callback. Called when the entity is first created. Intended to be assigned by Entity.Types.
Parameters:
-
gameGame- Game instance this obj is attached to.
-
typeString- Type of tile. When created this object is merged with the value of Tile.Types[type].
-
xNumber- The map tile coordinate position of this tile on the x axis.
-
yNumber- The map tile coordinate position of this tile on the y axis.
onEntityEnter
-
entity -
x -
y
Handles entity entering a new tile. Called after chaning the entities position
Parameters:
-
entityEntity- The entity entering the tile
-
xNumber- Map tile coord.
-
yNumber- Map tile coord.
Properties
bgColor
String | Bool
The background color the character displayed when rendering this tile. Not rendered if evaluates to false.
blocksLos
Bool
If this tile blocks line of sight.
char
String
The character displayed when rendering this tile.
color
String | Bool
The color of the character displayed when rendering this tile. Not rendered if evaluates to false.
explored
Bool
If this tile has been explored by the player.
name
String
Display name for this tile.
passable
Bool
If entities can move through this tile.
type
String
The type of entity this is.
When created this object is merged with the value of Tile.Types[type]. See constructor.
x
Number
The tile map tile x coord.
y
Number
The tile map tile y coord.
