Class: Tile

Necrowar. Tile

A Tile in the game that makes up the 2D map grid.

new Necrowar.Tile()

Initializes a Tile with basic logic as provided by the Creer code generator. Never use this directly. It is for internal Joueur use.

Extends

Members

number corpses

The amount of corpses on this tile.

string gameObjectName

Inherited From:
Necrowar.GameObject#gameObjectName
String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

string id

Inherited From:
Necrowar.GameObject#id
A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

boolean isCastle

Whether or not the tile is a castle tile.

boolean isGoldMine

Whether or not the tile is considered to be a gold mine or not.

boolean isGrass

Whether or not the tile is considered grass or not (Workers can walk on grass).

boolean isIslandGoldMine

Whether or not the tile is considered to be the island gold mine or not.

boolean isPath

Whether or not the tile is considered a path or not (Units can walk on paths).

boolean isRiver

Whether or not the tile is considered a river or not.

boolean isTower

Whether or not the tile is considered a tower or not.

boolean isUnitSpawn

Whether or not the tile is the unit spawn.

boolean isWall

Whether or not the tile can be moved on by workers.

boolean isWorkerSpawn

Whether or not the tile is the worker spawn.

Array.<string> logs

Inherited From:
Necrowar.GameObject#logs
Any strings logged will be stored here. Intended for debugging.

number numGhouls

The amount of Ghouls on this tile.

number numHounds

The amount of Hounds on this tile.

number numZombies

The amount of Zombies on this tile.
Which player owns this tile, only applies to grass tiles for workers, NULL otherwise.

Necrowar.Tile tileEast

The Tile to the 'East' of this one (x+1, y). Null if out of bounds of the map.

Necrowar.Tile tileNorth

The Tile to the 'North' of this one (x, y-1). Null if out of bounds of the map.

Necrowar.Tile tileSouth

The Tile to the 'South' of this one (x, y+1). Null if out of bounds of the map.

Necrowar.Tile tileWest

The Tile to the 'West' of this one (x-1, y). Null if out of bounds of the map.
The Tower on this Tile if present, otherwise null.
The Unit on this Tile if present, otherwise null.

number x

The x (horizontal) position of this Tile.

number y

The y (vertical) position of this Tile.

Methods

Array.<string> directions()

Gets the valid directions that tiles can be in, "North", "East", "South", or "West"
Returns: Array.<string>
"East", "South", and "West"

Array.<Tile> getNeighbors()

Gets the neighbors of this Tile
Returns: Array.<Tile>
The neighboring (adjacent) Tiles to this tile

boolean hasNeighbor()

Checks if this Tile has a specific neighboring Tile
Returns: boolean
if the tile is a neighbor of this Tile, false otherwise

boolean isPathable()

Checks if a Tile is pathable to units
Returns: boolean
True if pathable, false otherwise

log(message)

Inherited From:
Necrowar.GameObject#log
Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.
Name Type Description
message string A string to add to this GameObject's log. Intended for debugging.

boolean res(num)

Resurrect the corpses on this tile into Zombies.
Name Type Description
num number Number of zombies to resurrect.
Returns: boolean
True if successful res, false otherwise.

boolean spawnUnit(title)

Spawns a fighting unit on the correct tile.
Name Type Description
title string The title of the desired unit type.
Returns: boolean
True if successfully spawned, false otherwise.

boolean spawnWorker()

Spawns a worker on the correct tile.
Returns: boolean
True if successfully spawned, false otherwise.

string toString()

Inherited From:
BaseGameObject#toString
toString override for easier debugging
Returns: string
readable string in the format `GameObjectName #id`