From b57684c30686d2075e4d6cc6f65ba4577b32f4de Mon Sep 17 00:00:00 2001 From: Justin Young <62815737+jyoung4242@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:05:47 -0400 Subject: [PATCH] feat: added getters width and height to Tilemap (#3091) added getters width and height to Tilemap --------- Co-authored-by: Erik Onarheim --- src/engine/TileMap/TileMap.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/engine/TileMap/TileMap.ts b/src/engine/TileMap/TileMap.ts index 882b97848..57dcdb081 100644 --- a/src/engine/TileMap/TileMap.ts +++ b/src/engine/TileMap/TileMap.ts @@ -201,6 +201,20 @@ export class TileMap extends Entity { this._motion.vel = val; } + /** + * Width of the whole tile map in pixels + */ + public get width(): number { + return this.tileWidth * this.columns * this.scale.x; + } + + /** + * Height of the whole tilemap in pixels + */ + public get height(): number { + return this.tileHeight * this.rows * this.scale.y; + } + public emit>(eventName: TEventName, event: TileMapEvents[TEventName]): void; public emit(eventName: string, event?: any): void; public emit | string>(eventName: TEventName, event?: any): void {