melonjs 10.3.0 → 10.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/melonjs.js +3147 -3293
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3411 -3852
- package/dist/melonjs.module.js +3448 -3210
- package/package.json +18 -17
- package/src/audio/audio.js +29 -30
- package/src/camera/camera2d.js +46 -56
- package/src/entity/entity.js +30 -36
- package/src/game.js +21 -22
- package/src/geometries/ellipse.js +40 -46
- package/src/geometries/line.js +9 -11
- package/src/geometries/poly.js +53 -53
- package/src/geometries/rectangle.js +42 -44
- package/src/index.js +9 -26
- package/src/input/gamepad.js +11 -10
- package/src/input/input.js +2 -3
- package/src/input/keyboard.js +113 -113
- package/src/input/pointer.js +30 -31
- package/src/input/pointerevent.js +26 -26
- package/src/lang/deprecated.js +65 -6
- package/src/level/level.js +23 -24
- package/src/level/tiled/TMXGroup.js +7 -8
- package/src/level/tiled/TMXLayer.js +30 -32
- package/src/level/tiled/TMXObject.js +21 -21
- package/src/level/tiled/TMXTile.js +18 -18
- package/src/level/tiled/TMXTileMap.js +39 -44
- package/src/level/tiled/TMXTileset.js +12 -15
- package/src/level/tiled/TMXTilesetGroup.js +9 -9
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -5
- package/src/level/tiled/renderer/TMXRenderer.js +24 -25
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -4
- package/src/loader/loader.js +14 -15
- package/src/loader/loadingscreen.js +2 -4
- package/src/math/color.js +47 -66
- package/src/math/math.js +15 -16
- package/src/math/matrix2.js +53 -58
- package/src/math/matrix3.js +56 -62
- package/src/math/observable_vector2.js +75 -76
- package/src/math/observable_vector3.js +79 -80
- package/src/math/vector2.js +91 -92
- package/src/math/vector3.js +94 -96
- package/src/particles/emitter.js +38 -40
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +46 -143
- package/src/physics/bounds.js +47 -47
- package/src/physics/collision.js +13 -14
- package/src/physics/detector.js +18 -17
- package/src/physics/quadtree.js +17 -19
- package/src/physics/sat.js +26 -26
- package/src/physics/world.js +24 -28
- package/src/plugin/plugin.js +11 -14
- package/src/renderable/GUI.js +41 -46
- package/src/renderable/collectable.js +4 -8
- package/src/renderable/colorlayer.js +6 -10
- package/src/renderable/container.js +87 -72
- package/src/renderable/dragndrop.js +224 -0
- package/src/renderable/imagelayer.js +25 -31
- package/src/renderable/nineslicesprite.js +41 -41
- package/src/renderable/renderable.js +114 -125
- package/src/renderable/sprite.js +62 -68
- package/src/renderable/trigger.js +25 -30
- package/src/state/stage.js +13 -17
- package/src/state/state.js +26 -27
- package/src/system/device.js +74 -75
- package/src/system/event.js +71 -72
- package/src/system/pooling.js +11 -12
- package/src/system/save.js +3 -4
- package/src/system/timer.js +19 -20
- package/src/text/bitmaptext.js +57 -54
- package/src/text/bitmaptextdata.js +10 -10
- package/src/text/glyph.js +3 -0
- package/src/text/text.js +44 -49
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +43 -44
- package/src/utils/agent.js +3 -4
- package/src/utils/array.js +4 -5
- package/src/utils/file.js +3 -4
- package/src/utils/function.js +4 -5
- package/src/utils/string.js +7 -9
- package/src/utils/utils.js +4 -5
- package/src/video/canvas/canvas_renderer.js +58 -59
- package/src/video/renderer.js +49 -53
- package/src/video/texture.js +98 -111
- package/src/video/texture_cache.js +24 -6
- package/src/video/video.js +16 -17
- package/src/video/webgl/glshader.js +37 -38
- package/src/video/webgl/webgl_compositor.js +31 -32
- package/src/video/webgl/webgl_renderer.js +79 -80
- package/src/entity/draggable.js +0 -130
- package/src/entity/droptarget.js +0 -101
|
@@ -7,7 +7,6 @@ import { clamp } from "./../../math/math.js";
|
|
|
7
7
|
* @classdesc
|
|
8
8
|
* object group definition as defined in Tiled.
|
|
9
9
|
* (group definition is translated into the virtual `me.game.world` using `me.Container`)
|
|
10
|
-
* @class TMXGroup
|
|
11
10
|
* @ignore
|
|
12
11
|
*/
|
|
13
12
|
export default class TMXGroup {
|
|
@@ -19,7 +18,7 @@ export default class TMXGroup {
|
|
|
19
18
|
* @public
|
|
20
19
|
* @type {string}
|
|
21
20
|
* @name name
|
|
22
|
-
* @memberof
|
|
21
|
+
* @memberof TMXGroup
|
|
23
22
|
*/
|
|
24
23
|
this.name = data.name;
|
|
25
24
|
|
|
@@ -28,7 +27,7 @@ export default class TMXGroup {
|
|
|
28
27
|
* @public
|
|
29
28
|
* @type {number}
|
|
30
29
|
* @name width
|
|
31
|
-
* @memberof
|
|
30
|
+
* @memberof TMXGroup
|
|
32
31
|
*/
|
|
33
32
|
this.width = data.width || 0;
|
|
34
33
|
|
|
@@ -37,7 +36,7 @@ export default class TMXGroup {
|
|
|
37
36
|
* @public
|
|
38
37
|
* @type {number}
|
|
39
38
|
* @name height
|
|
40
|
-
* @memberof
|
|
39
|
+
* @memberof TMXGroup
|
|
41
40
|
*/
|
|
42
41
|
this.height = data.height || 0;
|
|
43
42
|
|
|
@@ -46,7 +45,7 @@ export default class TMXGroup {
|
|
|
46
45
|
* @public
|
|
47
46
|
* @type {string}
|
|
48
47
|
* @name tintcolor
|
|
49
|
-
* @memberof
|
|
48
|
+
* @memberof TMXGroup
|
|
50
49
|
*/
|
|
51
50
|
this.tintcolor = data.tintcolor;
|
|
52
51
|
|
|
@@ -55,17 +54,17 @@ export default class TMXGroup {
|
|
|
55
54
|
* @public
|
|
56
55
|
* @type {number}
|
|
57
56
|
* @name z
|
|
58
|
-
* @memberof
|
|
57
|
+
* @memberof TMXGroup
|
|
59
58
|
*/
|
|
60
59
|
this.z = z;
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
62
|
* group objects list definition
|
|
64
|
-
* @see
|
|
63
|
+
* @see TMXObject
|
|
65
64
|
* @public
|
|
66
65
|
* @type {object[]}
|
|
67
66
|
* @name name
|
|
68
|
-
* @memberof
|
|
67
|
+
* @memberof TMXGroup
|
|
69
68
|
*/
|
|
70
69
|
this.objects = [];
|
|
71
70
|
|
|
@@ -63,22 +63,20 @@ function preRenderLayer(layer, renderer) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
+
* @classdesc
|
|
66
67
|
* a TMX Tile Layer Object
|
|
67
68
|
* Tiled QT 0.7.x format
|
|
68
|
-
* @
|
|
69
|
-
* @augments me.Renderable
|
|
70
|
-
* @memberof me
|
|
71
|
-
* @param {object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
72
|
-
* @param {object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
73
|
-
* @param {number} tilewidth width of each tile in pixels
|
|
74
|
-
* @param {number} tileheight height of each tile in pixels
|
|
75
|
-
* @param {string} orientation "isometric" or "orthogonal"
|
|
76
|
-
* @param {me.TMXTilesetGroup} tilesets tileset as defined in Tiled
|
|
77
|
-
* @param {number} z z-index position
|
|
69
|
+
* @augments Renderable
|
|
78
70
|
*/
|
|
79
71
|
class TMXLayer extends Renderable {
|
|
80
72
|
/**
|
|
81
|
-
* @
|
|
73
|
+
* @param {object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
74
|
+
* @param {object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
75
|
+
* @param {number} tilewidth width of each tile in pixels
|
|
76
|
+
* @param {number} tileheight height of each tile in pixels
|
|
77
|
+
* @param {string} orientation "isometric" or "orthogonal"
|
|
78
|
+
* @param {TMXTilesetGroup} tilesets tileset as defined in Tiled
|
|
79
|
+
* @param {number} z z-index position
|
|
82
80
|
*/
|
|
83
81
|
constructor(map, data, tilewidth, tileheight, orientation, tilesets, z) {
|
|
84
82
|
// super constructor
|
|
@@ -94,8 +92,8 @@ class TMXLayer extends Renderable {
|
|
|
94
92
|
/**
|
|
95
93
|
* The Layer corresponding Tilesets
|
|
96
94
|
* @public
|
|
97
|
-
* @type {
|
|
98
|
-
* @name
|
|
95
|
+
* @type {TMXTilesetGroup}
|
|
96
|
+
* @name TMXLayer#tilesets
|
|
99
97
|
*/
|
|
100
98
|
this.tilesets = tilesets;
|
|
101
99
|
|
|
@@ -117,8 +115,8 @@ class TMXLayer extends Renderable {
|
|
|
117
115
|
/**
|
|
118
116
|
* All animated tilesets in this layer
|
|
119
117
|
* @ignore
|
|
120
|
-
* @type {
|
|
121
|
-
* @name
|
|
118
|
+
* @type {TMXTileset[]}
|
|
119
|
+
* @name TMXLayer#animatedTilesets
|
|
122
120
|
*/
|
|
123
121
|
this.animatedTilesets = [];
|
|
124
122
|
|
|
@@ -126,7 +124,7 @@ class TMXLayer extends Renderable {
|
|
|
126
124
|
* Layer contains tileset animations
|
|
127
125
|
* @public
|
|
128
126
|
* @type {boolean}
|
|
129
|
-
* @name
|
|
127
|
+
* @name TMXLayer#isAnimated
|
|
130
128
|
*/
|
|
131
129
|
this.isAnimated = false;
|
|
132
130
|
|
|
@@ -136,7 +134,7 @@ class TMXLayer extends Renderable {
|
|
|
136
134
|
* @public
|
|
137
135
|
* @type {string}
|
|
138
136
|
* @default "right-down"
|
|
139
|
-
* @name
|
|
137
|
+
* @name TMXLayer#renderorder
|
|
140
138
|
*/
|
|
141
139
|
this.renderorder = data.renderorder || "right-down";
|
|
142
140
|
|
|
@@ -242,10 +240,10 @@ class TMXLayer extends Renderable {
|
|
|
242
240
|
/**
|
|
243
241
|
* Set the TMX renderer for this layer object
|
|
244
242
|
* @name setRenderer
|
|
245
|
-
* @memberof
|
|
243
|
+
* @memberof TMXLayer
|
|
246
244
|
* @public
|
|
247
245
|
* @function
|
|
248
|
-
* @param {
|
|
246
|
+
* @param {TMXRenderer} renderer
|
|
249
247
|
* @example
|
|
250
248
|
* // use the parent map default renderer
|
|
251
249
|
* var layer = new me.TMXLayer(...);
|
|
@@ -258,10 +256,10 @@ class TMXLayer extends Renderable {
|
|
|
258
256
|
/**
|
|
259
257
|
* Return the layer current renderer object
|
|
260
258
|
* @name getRenderer
|
|
261
|
-
* @memberof
|
|
259
|
+
* @memberof TMXLayer
|
|
262
260
|
* @public
|
|
263
261
|
* @function
|
|
264
|
-
* @returns {
|
|
262
|
+
* @returns {TMXRenderer} renderer
|
|
265
263
|
*/
|
|
266
264
|
getRenderer() {
|
|
267
265
|
return this.renderer;
|
|
@@ -271,7 +269,7 @@ class TMXLayer extends Renderable {
|
|
|
271
269
|
/**
|
|
272
270
|
* Return the TileId of the Tile at the specified position
|
|
273
271
|
* @name getTileId
|
|
274
|
-
* @memberof
|
|
272
|
+
* @memberof TMXLayer
|
|
275
273
|
* @public
|
|
276
274
|
* @function
|
|
277
275
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
@@ -286,12 +284,12 @@ class TMXLayer extends Renderable {
|
|
|
286
284
|
/**
|
|
287
285
|
* Return the Tile object at the specified position
|
|
288
286
|
* @name getTile
|
|
289
|
-
* @memberof
|
|
287
|
+
* @memberof TMXLayer
|
|
290
288
|
* @public
|
|
291
289
|
* @function
|
|
292
290
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
293
291
|
* @param {number} y Y coordinate (in world/pixels coordinates)
|
|
294
|
-
* @returns {
|
|
292
|
+
* @returns {Tile} corresponding tile or null if there is no defined tile at the coordinate or if outside of the layer bounds
|
|
295
293
|
* @example
|
|
296
294
|
* // get the TMX Map Layer called "Front layer"
|
|
297
295
|
* var layer = me.game.world.getChildByName("Front Layer")[0];
|
|
@@ -312,13 +310,13 @@ class TMXLayer extends Renderable {
|
|
|
312
310
|
/**
|
|
313
311
|
* assign the given Tile object to the specified position
|
|
314
312
|
* @name getTile
|
|
315
|
-
* @memberof
|
|
313
|
+
* @memberof TMXLayer
|
|
316
314
|
* @public
|
|
317
315
|
* @function
|
|
318
|
-
* @param {
|
|
316
|
+
* @param {Tile} tile the tile object to be assigned
|
|
319
317
|
* @param {number} x x coordinate (in world/pixels coordinates)
|
|
320
318
|
* @param {number} y y coordinate (in world/pixels coordinates)
|
|
321
|
-
* @returns {
|
|
319
|
+
* @returns {Tile} the tile object
|
|
322
320
|
*/
|
|
323
321
|
setTile(tile, x, y) {
|
|
324
322
|
this.layerData[x][y] = tile;
|
|
@@ -328,13 +326,13 @@ class TMXLayer extends Renderable {
|
|
|
328
326
|
/**
|
|
329
327
|
* return a new the Tile object corresponding to the given tile id
|
|
330
328
|
* @name setTile
|
|
331
|
-
* @memberof
|
|
329
|
+
* @memberof TMXLayer
|
|
332
330
|
* @public
|
|
333
331
|
* @function
|
|
334
332
|
* @param {number} tileId tileId
|
|
335
333
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
336
334
|
* @param {number} y Y coordinate (in world/pixels coordinates)
|
|
337
|
-
* @returns {
|
|
335
|
+
* @returns {Tile} the tile object
|
|
338
336
|
*/
|
|
339
337
|
getTileById(tileId, x, y) {
|
|
340
338
|
if (!this.tileset.contains(tileId)) {
|
|
@@ -347,13 +345,13 @@ class TMXLayer extends Renderable {
|
|
|
347
345
|
/**
|
|
348
346
|
* Return the Tile object at the specified tile coordinates
|
|
349
347
|
* @name cellAt
|
|
350
|
-
* @memberof
|
|
348
|
+
* @memberof TMXLayer
|
|
351
349
|
* @public
|
|
352
350
|
* @function
|
|
353
351
|
* @param {number} x x position of the tile (in Tile unit)
|
|
354
352
|
* @param {number} y x position of the tile (in Tile unit)
|
|
355
353
|
* @param {number} [boundsCheck=true] check first if within the layer bounds
|
|
356
|
-
* @returns {
|
|
354
|
+
* @returns {Tile} corresponding tile or null if there is no defined tile at the position or if outside of the layer bounds
|
|
357
355
|
* @example
|
|
358
356
|
* // return the first tile at offset 0, 0
|
|
359
357
|
* var tile = layer.cellAt(0, 0);
|
|
@@ -374,7 +372,7 @@ class TMXLayer extends Renderable {
|
|
|
374
372
|
/**
|
|
375
373
|
* clear the tile at the specified position
|
|
376
374
|
* @name clearTile
|
|
377
|
-
* @memberof
|
|
375
|
+
* @memberof TMXLayer
|
|
378
376
|
* @public
|
|
379
377
|
* @function
|
|
380
378
|
* @param {number} x X coordinate (in map coordinates: row/column)
|
|
@@ -7,9 +7,9 @@ import Line from "./../../geometries/line.js";
|
|
|
7
7
|
import { degToRad } from "./../../math/math.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
+
* @classdesc
|
|
10
11
|
* a TMX Object defintion, as defined in Tiled
|
|
11
12
|
* (Object definition is translated into the virtual `me.game.world` using `me.Renderable`)
|
|
12
|
-
* @class TMXObject
|
|
13
13
|
* @ignore
|
|
14
14
|
*/
|
|
15
15
|
export default class TMXObject {
|
|
@@ -21,7 +21,7 @@ export default class TMXObject {
|
|
|
21
21
|
* @public
|
|
22
22
|
* @type {object[]}
|
|
23
23
|
* @name points
|
|
24
|
-
* @memberof
|
|
24
|
+
* @memberof TMXObject
|
|
25
25
|
*/
|
|
26
26
|
this.points = undefined;
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ export default class TMXObject {
|
|
|
30
30
|
* @public
|
|
31
31
|
* @type {string}
|
|
32
32
|
* @name name
|
|
33
|
-
* @memberof
|
|
33
|
+
* @memberof TMXObject
|
|
34
34
|
*/
|
|
35
35
|
this.name = settings.name;
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ export default class TMXObject {
|
|
|
39
39
|
* @public
|
|
40
40
|
* @type {number}
|
|
41
41
|
* @name x
|
|
42
|
-
* @memberof
|
|
42
|
+
* @memberof TMXObject
|
|
43
43
|
*/
|
|
44
44
|
this.x = +settings.x;
|
|
45
45
|
|
|
@@ -48,7 +48,7 @@ export default class TMXObject {
|
|
|
48
48
|
* @public
|
|
49
49
|
* @type {number}
|
|
50
50
|
* @name y
|
|
51
|
-
* @memberof
|
|
51
|
+
* @memberof TMXObject
|
|
52
52
|
*/
|
|
53
53
|
this.y = +settings.y;
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ export default class TMXObject {
|
|
|
57
57
|
* @public
|
|
58
58
|
* @type {number}
|
|
59
59
|
* @name z
|
|
60
|
-
* @memberof
|
|
60
|
+
* @memberof TMXObject
|
|
61
61
|
*/
|
|
62
62
|
this.z = +z;
|
|
63
63
|
|
|
@@ -66,7 +66,7 @@ export default class TMXObject {
|
|
|
66
66
|
* @public
|
|
67
67
|
* @type {number}
|
|
68
68
|
* @name width
|
|
69
|
-
* @memberof
|
|
69
|
+
* @memberof TMXObject
|
|
70
70
|
*/
|
|
71
71
|
this.width = +settings.width || 0;
|
|
72
72
|
|
|
@@ -75,7 +75,7 @@ export default class TMXObject {
|
|
|
75
75
|
* @public
|
|
76
76
|
* @type {number}
|
|
77
77
|
* @name height
|
|
78
|
-
* @memberof
|
|
78
|
+
* @memberof TMXObject
|
|
79
79
|
*/
|
|
80
80
|
this.height = +settings.height || 0;
|
|
81
81
|
|
|
@@ -85,7 +85,7 @@ export default class TMXObject {
|
|
|
85
85
|
* @public
|
|
86
86
|
* @type {number}
|
|
87
87
|
* @name gid
|
|
88
|
-
* @memberof
|
|
88
|
+
* @memberof TMXObject
|
|
89
89
|
*/
|
|
90
90
|
this.gid = +settings.gid || null;
|
|
91
91
|
|
|
@@ -94,7 +94,7 @@ export default class TMXObject {
|
|
|
94
94
|
* @public
|
|
95
95
|
* @type {string}
|
|
96
96
|
* @name tintcolor
|
|
97
|
-
* @memberof
|
|
97
|
+
* @memberof TMXObject
|
|
98
98
|
*/
|
|
99
99
|
this.tintcolor = settings.tintcolor;
|
|
100
100
|
|
|
@@ -103,7 +103,7 @@ export default class TMXObject {
|
|
|
103
103
|
* @public
|
|
104
104
|
* @type {string}
|
|
105
105
|
* @name type
|
|
106
|
-
* @memberof
|
|
106
|
+
* @memberof TMXObject
|
|
107
107
|
*/
|
|
108
108
|
this.type = settings.type;
|
|
109
109
|
|
|
@@ -113,7 +113,7 @@ export default class TMXObject {
|
|
|
113
113
|
* @type {object}
|
|
114
114
|
* @see http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#text
|
|
115
115
|
* @name type
|
|
116
|
-
* @memberof
|
|
116
|
+
* @memberof TMXObject
|
|
117
117
|
*/
|
|
118
118
|
this.type = settings.type;
|
|
119
119
|
|
|
@@ -122,7 +122,7 @@ export default class TMXObject {
|
|
|
122
122
|
* @public
|
|
123
123
|
* @type {number}
|
|
124
124
|
* @name rotation
|
|
125
|
-
* @memberof
|
|
125
|
+
* @memberof TMXObject
|
|
126
126
|
*/
|
|
127
127
|
this.rotation = degToRad(+settings.rotation || 0);
|
|
128
128
|
|
|
@@ -131,7 +131,7 @@ export default class TMXObject {
|
|
|
131
131
|
* @public
|
|
132
132
|
* @type {number}
|
|
133
133
|
* @name id
|
|
134
|
-
* @memberof
|
|
134
|
+
* @memberof TMXObject
|
|
135
135
|
*/
|
|
136
136
|
this.id = +settings.id || undefined;
|
|
137
137
|
|
|
@@ -140,7 +140,7 @@ export default class TMXObject {
|
|
|
140
140
|
* @public
|
|
141
141
|
* @type {string}
|
|
142
142
|
* @name orientation
|
|
143
|
-
* @memberof
|
|
143
|
+
* @memberof TMXObject
|
|
144
144
|
*/
|
|
145
145
|
this.orientation = map.orientation;
|
|
146
146
|
|
|
@@ -149,7 +149,7 @@ export default class TMXObject {
|
|
|
149
149
|
* @public
|
|
150
150
|
* @type {object[]}
|
|
151
151
|
* @name shapes
|
|
152
|
-
* @memberof
|
|
152
|
+
* @memberof TMXObject
|
|
153
153
|
*/
|
|
154
154
|
this.shapes = undefined;
|
|
155
155
|
|
|
@@ -158,7 +158,7 @@ export default class TMXObject {
|
|
|
158
158
|
* @public
|
|
159
159
|
* @type {boolean}
|
|
160
160
|
* @name isEllipse
|
|
161
|
-
* @memberof
|
|
161
|
+
* @memberof TMXObject
|
|
162
162
|
*/
|
|
163
163
|
this.isEllipse = false;
|
|
164
164
|
|
|
@@ -167,7 +167,7 @@ export default class TMXObject {
|
|
|
167
167
|
* @public
|
|
168
168
|
* @type {boolean}
|
|
169
169
|
* @name isPolygon
|
|
170
|
-
* @memberof
|
|
170
|
+
* @memberof TMXObject
|
|
171
171
|
*/
|
|
172
172
|
this.isPolygon = false;
|
|
173
173
|
|
|
@@ -176,7 +176,7 @@ export default class TMXObject {
|
|
|
176
176
|
* @public
|
|
177
177
|
* @type {boolean}
|
|
178
178
|
* @name isPolyLine
|
|
179
|
-
* @memberof
|
|
179
|
+
* @memberof TMXObject
|
|
180
180
|
*/
|
|
181
181
|
this.isPolyLine = false;
|
|
182
182
|
|
|
@@ -248,10 +248,10 @@ export default class TMXObject {
|
|
|
248
248
|
/**
|
|
249
249
|
* parses the TMX shape definition and returns a corresponding array of me.Shape object
|
|
250
250
|
* @name parseTMXShapes
|
|
251
|
-
* @memberof
|
|
251
|
+
* @memberof TMXObject
|
|
252
252
|
* @private
|
|
253
253
|
* @function
|
|
254
|
-
* @returns {
|
|
254
|
+
* @returns {Polygon[]|Line[]|Ellipse[]} an array of shape objects
|
|
255
255
|
*/
|
|
256
256
|
parseTMXShapes() {
|
|
257
257
|
var i = 0;
|
|
@@ -9,17 +9,17 @@ var TMX_FLIP_H = 0x80000000,
|
|
|
9
9
|
TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
+
* @classdesc
|
|
12
13
|
* a basic tile object
|
|
13
|
-
* @
|
|
14
|
-
* @augments me.Bounds
|
|
15
|
-
* @memberof me
|
|
16
|
-
* @param {number} x x index of the Tile in the map
|
|
17
|
-
* @param {number} y y index of the Tile in the map
|
|
18
|
-
* @param {number} gid tile gid
|
|
19
|
-
* @param {me.TMXTileset} tileset the corresponding tileset object
|
|
14
|
+
* @augments Bounds
|
|
20
15
|
*/
|
|
21
16
|
class Tile extends Bounds {
|
|
22
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @param {number} x x index of the Tile in the map
|
|
19
|
+
* @param {number} y y index of the Tile in the map
|
|
20
|
+
* @param {number} gid tile gid
|
|
21
|
+
* @param {TMXTileset} tileset the corresponding tileset object
|
|
22
|
+
*/
|
|
23
23
|
constructor(x, y, gid, tileset) {
|
|
24
24
|
var width, height;
|
|
25
25
|
|
|
@@ -41,8 +41,8 @@ class Tile extends Bounds {
|
|
|
41
41
|
/**
|
|
42
42
|
* tileset
|
|
43
43
|
* @public
|
|
44
|
-
* @type {
|
|
45
|
-
* @name
|
|
44
|
+
* @type {TMXTileset}
|
|
45
|
+
* @name Tile#tileset
|
|
46
46
|
*/
|
|
47
47
|
this.tileset = tileset;
|
|
48
48
|
|
|
@@ -60,28 +60,28 @@ class Tile extends Bounds {
|
|
|
60
60
|
* tileId
|
|
61
61
|
* @public
|
|
62
62
|
* @type {number}
|
|
63
|
-
* @name
|
|
63
|
+
* @name Tile#tileId
|
|
64
64
|
*/
|
|
65
65
|
this.tileId = gid;
|
|
66
66
|
/**
|
|
67
67
|
* True if the tile is flipped horizontally<br>
|
|
68
68
|
* @public
|
|
69
69
|
* @type {boolean}
|
|
70
|
-
* @name
|
|
70
|
+
* @name Tile#flipX
|
|
71
71
|
*/
|
|
72
72
|
this.flippedX = (this.tileId & TMX_FLIP_H) !== 0;
|
|
73
73
|
/**
|
|
74
74
|
* True if the tile is flipped vertically<br>
|
|
75
75
|
* @public
|
|
76
76
|
* @type {boolean}
|
|
77
|
-
* @name
|
|
77
|
+
* @name Tile#flippedY
|
|
78
78
|
*/
|
|
79
79
|
this.flippedY = (this.tileId & TMX_FLIP_V) !== 0;
|
|
80
80
|
/**
|
|
81
81
|
* True if the tile is flipped anti-diagonally<br>
|
|
82
82
|
* @public
|
|
83
83
|
* @type {boolean}
|
|
84
|
-
* @name
|
|
84
|
+
* @name Tile#flippedAD
|
|
85
85
|
*/
|
|
86
86
|
this.flippedAD = (this.tileId & TMX_FLIP_AD) !== 0;
|
|
87
87
|
|
|
@@ -89,7 +89,7 @@ class Tile extends Bounds {
|
|
|
89
89
|
* Global flag that indicates if the tile is flipped<br>
|
|
90
90
|
* @public
|
|
91
91
|
* @type {boolean}
|
|
92
|
-
* @name
|
|
92
|
+
* @name Tile#flipped
|
|
93
93
|
*/
|
|
94
94
|
this.flipped = this.flippedX || this.flippedY || this.flippedAD;
|
|
95
95
|
|
|
@@ -130,11 +130,11 @@ class Tile extends Bounds {
|
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* return a renderable object for this Tile object
|
|
133
|
-
* @name
|
|
133
|
+
* @name Tile#getRenderable
|
|
134
134
|
* @public
|
|
135
135
|
* @function
|
|
136
|
-
* @param {object} [settings] see {@link
|
|
137
|
-
* @returns {
|
|
136
|
+
* @param {object} [settings] see {@link Sprite}
|
|
137
|
+
* @returns {Renderable} a me.Sprite object
|
|
138
138
|
*/
|
|
139
139
|
getRenderable(settings) {
|
|
140
140
|
var renderable;
|