Tile Class
Represents a tile in the game map.
Constructor
Tile
-
game
-
type
-
x
-
y
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.
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:
-
entity
Object- The player or entity attempting to move into this tile.
getTileDrawData
()
TileDrawData
Returns as tileData
object 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:
-
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
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
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.