The canvas object.
Tile width in world coordinates (pixels). Default is 130.
Tile height in world coordinates (pixels). Always equal to dx (square tiles).
Number of horizontal tiles. Calculated based on settings and canvas aspect ratio.
Number of vertical tiles.
Flat array of all tiles in the map, indexed as i * Ny + j.
Spatial sorting: add object to corresponding tile list.
The object to add.
Spatial sorting: clear tile object lists.
Draws the map.
The context.
Gets a tile by its grid index.
X index.
Y index.
The tile or null if out of bounds.
Gets a tile by its world position.
X coordinate.
Y coordinate.
The tile or null.
Update sizes of map and tiles, for window.onresize.
Returns a random free spawn point.
Recursion counter.
coordinates.
Represents the game map.
Discretized in Nx * Ny tiles, which can be separated by walls (walls) also the tiles keep object lists for spatial sorting the canvas is passed to the constructor to provide the size of the canvas