Skip to content

Commit

Permalink
feat: added getters width and height to Tilemap (#3091)
Browse files Browse the repository at this point in the history
added getters width and height to Tilemap 

---------

Co-authored-by: Erik Onarheim <[email protected]>
  • Loading branch information
jyoung4242 and eonarheim authored Jun 11, 2024
1 parent 3b6bd7d commit b57684c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/engine/TileMap/TileMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TEventName extends EventKey<TileMapEvents>>(eventName: TEventName, event: TileMapEvents[TEventName]): void;
public emit(eventName: string, event?: any): void;
public emit<TEventName extends EventKey<TileMapEvents> | string>(eventName: TEventName, event?: any): void {
Expand Down

0 comments on commit b57684c

Please sign in to comment.