Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tile

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

Hierarchy

Implements

  • IBaseGameObject

Index

Properties

corpses

corpses: number

The amount of corpses on this tile.

gameObjectName

gameObjectName: string

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.

id

id: string

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.

isCastle

isCastle: boolean

Whether or not the tile is a castle tile.

isGoldMine

isGoldMine: boolean

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

isGrass

isGrass: boolean

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

isIslandGoldMine

isIslandGoldMine: boolean

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

isPath

isPath: boolean

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

isRiver

isRiver: boolean

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

isTower

isTower: boolean

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

isUnitSpawn

isUnitSpawn: boolean

Whether or not the tile is the unit spawn.

isWall

isWall: boolean

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

isWorkerSpawn

isWorkerSpawn: boolean

Whether or not the tile is the worker spawn.

logs

logs: string[]

Any strings logged will be stored here. Intended for debugging.

numGhouls

numGhouls: number

The amount of Ghouls on this tile.

numHounds

numHounds: number

The amount of Hounds on this tile.

numZombies

numZombies: number

The amount of Zombies on this tile.

owner

owner: Player | undefined

Which player owns this tile, only applies to grass tiles for workers, NULL otherwise.

tileEast

tileEast: Tile | undefined

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

tileNorth

tileNorth: Tile | undefined

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

tileSouth

tileSouth: Tile | undefined

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

tileWest

tileWest: Tile | undefined

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

tower

tower: Tower | undefined

The Tower on this Tile if present, otherwise null.

unit

unit: Unit | undefined

The Unit on this Tile if present, otherwise null.

x

x: number

The x (horizontal) position of this Tile.

y

y: number

The y (vertical) position of this Tile.

Static directions

directions: ["North", "East", "South", "West"] = ["North", "East", "South", "West"]

Gets the valid directions that tiles can be in, "North", "East", "South", or "West"

returns

Methods

getNeighbors

  • getNeighbors(): Tile[]
  • Gets the neighbors of this Tile.

    Returns Tile[]

    The neighboring (adjacent) Tiles to this tile.

hasNeighbor

  • hasNeighbor(tile: Tile | undefined): boolean
  • Checks if this Tile has a specific neighboring Tile

    Parameters

    • tile: Tile | undefined

    Returns boolean

    true if the tile is a neighbor of this Tile, false otherwise

isPathable

  • isPathable(): boolean
  • Checks if a Tile is pathable to units

    Returns boolean

    True if pathable, false otherwise

log

  • log(message: string): Promise<void>
  • Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

    Parameters

    • message: string

      A string to add to this GameObject's log. Intended for debugging.

    Returns Promise<void>

res

  • res(num: number): Promise<boolean>
  • Resurrect the corpses on this tile into Zombies.

    Parameters

    • num: number

      Number of zombies to resurrect.

    Returns Promise<boolean>

    True if successful res, false otherwise.

spawnUnit

  • spawnUnit(title: string): Promise<boolean>
  • Spawns a fighting unit on the correct tile.

    Parameters

    • title: string

      The title of the desired unit type.

    Returns Promise<boolean>

    True if successfully spawned, false otherwise.

spawnWorker

  • spawnWorker(): Promise<boolean>
  • Spawns a worker on the correct tile.

    Returns Promise<boolean>

    True if successfully spawned, false otherwise.

toString

  • toString(): string
  • A toString override for easier debugging.

    example

    String(gameObject); 🠞 "GameObjectName #1245"

    Returns string

    A human readable representation of the game object.

Generated using TypeDoc