import GameObject from '../core/GameObject.js'; import Vector2 from '../math/Vector2.js'; /** * Properties for creating a new Tilemap. */ export interface TilemapProps { /** Unique tag for the object. */ tag?: string; /** Hidden identifier linking runtime object to its source code location. */ __sourceId?: string; /** Image element or tag from ResourceLoader. */ tileset: HTMLImageElement | string; /** 2D array of tile indices. */ data: number[][]; /** Tile size in pixels. */ tileSize: number; /** Number of columns in the tileset image. */ tilesetCols: number; /** Initial world position. */ position: Vector2; /** Rendering order. */ zIndex?: number; } /** * Represents a grid-based map rendered from a tileset. */ export default class Tilemap extends GameObject { /** The source image for the tileset. */ tileset: HTMLImageElement; /** 2D array of tile indices. */ data: number[][]; /** Tile size in pixels. */ tileSize: number; /** Number of columns in the tileset image. */ tilesetCols: number; /** * initialises a new instance of a Tilemap. * @param props Configuration properties for the tilemap. */ constructor(props: TilemapProps); }