MCPcopy Create free account
hub / github.com/melonjs/melonJS / constructor

Method constructor

packages/melonjs/src/level/tiled/TMXTileMap.js:150–303  ·  view source on GitHub ↗

* @param {string} levelId - name of TMX map * @param {object} data - TMX map in JSON format * @example * // create a new level object based on the TMX JSON object * let level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId)); * // add the level to the game world container * level.a

(levelId, data)

Source from the content-addressed store, hash-verified

148 * level.addTo(app.world, true);
149 */
150 constructor(levelId, data) {
151 /**
152 * the level data (JSON)
153 * @ignore
154 */
155 this.data = data;
156
157 /**
158 * name of the tilemap
159 * @type {string}
160 */
161 this.name = levelId;
162
163 /**
164 * level format discriminator used by the level director's dispatch
165 * @type {string}
166 */
167 this.format = "tmx";
168
169 /**
170 * width of the tilemap in tiles
171 * @type {number}
172 */
173 this.cols = +data.width;
174
175 /**
176 * height of the tilemap in tiles
177 * @type {number}
178 */
179 this.rows = +data.height;
180
181 /**
182 * Tile width
183 * @type {number}
184 */
185 this.tilewidth = +data.tilewidth;
186
187 /**
188 * Tile height
189 * @type {number}
190 */
191 this.tileheight = +data.tileheight;
192
193 /**
194 * is the map an infinite map
195 * @type {number}
196 * @default 0
197 */
198 this.infinite = +data.infinite || 0;
199
200 /**
201 * the map orientation type. melonJS supports “orthogonal”, “isometric”, “staggered”, “hexagonal” and “oblique”.
202 * @type {string}
203 * @default “orthogonal”
204 */
205 this.orientation = data.orientation;
206
207 /**

Callers

nothing calls this directly

Calls 6

getRendererMethod · 0.95
checkVersionFunction · 0.90
warningFunction · 0.90
applyTMXPropertiesFunction · 0.90
cloneMethod · 0.65
getBoundsMethod · 0.65

Tested by

no test coverage detected