duckengine
Version:
A 2D Game Engine for the web.
93 lines (92 loc) • 2.31 kB
TypeScript
import { Duck } from '../..';
import Game from '../game';
import Vector2 from '../math/vector2';
import Scene from '../scene';
import TileLayer from './tilelayer';
/**
* @class Map
* @classdesc Creates a DuckEngine Map
* @description The Map Class. Base Map class, extends by TileMap
* @since 1.2.0
*/
export default class Map implements Duck.Types.Renderable {
/**
* @memberof Map
* @description A unique identifier for the Map
* @type number
* @since 2.0.0
*/
readonly id: string;
/**
* @memberof Map
* @description "Shape" of the map, always "Map", used by Scene.displayList to distinguish between Renderables
* @type string
* @since 2.0.0
*/
readonly shape: string;
/**
* @memberof Map
* @description The map origin point
* @type Vector2
* @since 2.0.0
*/
origin: Vector2;
/**
* @memberof Map
* @description An array of TileLayers
* @type TileLayers[]
* @since 2.0.0
*/
tileLayers: TileLayer[];
/**
* @memberof Map
* @description Game instance
* @type Game
* @since 2.0.0
*/
game: Game;
/**
* @memberof Map
* @description Scene instance
* @type Scene
* @since 2.0.0
*/
scene: Scene;
/**
* @memberof Map
* @description Determines if the Map is visible or not
* @type boolean
* @since 2.0.0
*/
visible: boolean;
/**
* @memberof Map
* @description Used for depth sorting, default: 2
* @type number
* @since 2.0.0
*/
zIndex: number;
/**
* @memberof Map
* @description Determines if the Map should be visible by the current scene's current camera
* @type boolean
* @since 2.1.0
*/
culled: boolean;
/**
* @constructor Map
* @description Creates a Map instance.
* @param {TileLayer[]} tileLayers An array of TileLayers
* @param {Game} game Game instance
* @param {Scene} scene Scene instance
* @since 2.0.0
*/
constructor(origin: Duck.Types.Math.Vector2Like, tileLayers: TileLayer[], game: Game, scene: Scene);
/**
* @description Draws the map.
*
* DO NOT CALL MANUALLY, CALLED IN GAME LOOP USING SCENE.displayList
*
*/
_draw(): void;
}