Tile

class games.newtonian.tile.Tile

Bases: games.newtonian.game_object.GameObject

The class representing the Tile in the Newtonian game.

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

property blueium

The amount of blueium on this tile.

Type

int

property blueium_ore

The amount of blueium ore on this tile.

Type

int

property decoration

(Visualizer only) Different tile types, cracked, slightly dirty, etc. This has no effect on gameplay, but feel free to use it if you want.

Type

int

property direction

The direction of a conveyor belt (‘blank’, ‘north’, ‘east’, ‘south’, or ‘west’). Blank means conveyor doesn’t move.

Type

‘blank’, ‘north’, ‘east’, ‘south’, or ‘west’

directions = ['North', 'East', 'South', 'West']

The valid directions that tiles can be in, “North”, “East”, “South”, or “West”

Type

int

property game_object_name

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.

Type

str

get_neighbors() → List[games.newtonian.tile.Tile]

Gets the neighbors of this Tile

Returns

The list of neighboring Tiles of this Tile.

Return type

list[games.newtonian.tile.Tile]

has_neighbor(tile: games.newtonian.tile.Tile) → bool

Checks if this Tile has a specific neighboring Tile.

Parameters

tile (games.newtonian.tile.Tile) – The Tile to check against.

Returns

True if the tile is a neighbor of this Tile, False otherwise

Return type

bool

property 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.

Type

str

is_pathable() → bool

Checks if a Tile is pathable to units

Returns

True if pathable, False otherwise.

Return type

bool

property is_wall

Whether or not the tile is a wall.

Type

bool

log(message: str) → None

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 (str) – A string to add to this GameObject’s log. Intended for debugging.

property logs

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

Type

list[str]

property machine

The Machine on this Tile if present, otherwise None.

Type

games.newtonian.machine.Machine or None

property owner

The owner of this Tile, or None if owned by no-one. Only for generators and spawn areas.

Type

games.newtonian.player.Player or None

property redium

The amount of redium on this tile.

Type

int

property redium_ore

The amount of redium ore on this tile.

Type

int

property tile_east

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

Type

games.newtonian.tile.Tile or None

property tile_north

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

Type

games.newtonian.tile.Tile or None

property tile_south

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

Type

games.newtonian.tile.Tile or None

property tile_west

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

Type

games.newtonian.tile.Tile or None

property type

The type of Tile this is (‘normal’, ‘generator’, ‘conveyor’, or ‘spawn’).

Type

‘normal’, ‘generator’, ‘conveyor’, or ‘spawn’

property unit

The Unit on this Tile if present, otherwise None.

Type

games.newtonian.unit.Unit or None

property x

The x (horizontal) position of this Tile.

Type

int

property y

The y (vertical) position of this Tile.

Type

int