melonjs 10.2.3 → 10.3.0
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/dist/melonjs.js +1741 -1558
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +1256 -1758
- package/dist/melonjs.module.js +1734 -1582
- package/package.json +12 -12
- package/src/audio/audio.js +3 -3
- package/src/camera/camera2d.js +26 -27
- package/src/entity/draggable.js +10 -19
- package/src/entity/droptarget.js +12 -20
- package/src/entity/entity.js +13 -13
- package/src/game.js +6 -6
- package/src/{shapes → geometries}/ellipse.js +19 -20
- package/src/{shapes → geometries}/line.js +6 -7
- package/src/{shapes → geometries}/poly.js +70 -23
- package/src/{shapes → geometries}/rectangle.js +23 -24
- package/src/index.js +8 -9
- package/src/input/gamepad.js +7 -7
- package/src/input/input.js +2 -2
- package/src/input/keyboard.js +108 -108
- package/src/input/pointer.js +61 -28
- package/src/input/pointerevent.js +79 -16
- package/src/lang/deprecated.js +26 -15
- package/src/level/level.js +10 -10
- package/src/level/tiled/TMXGroup.js +6 -7
- package/src/level/tiled/TMXLayer.js +10 -11
- package/src/level/tiled/TMXObject.js +57 -51
- package/src/level/tiled/TMXTile.js +2 -3
- package/src/level/tiled/TMXTileMap.js +3 -4
- package/src/level/tiled/TMXTileset.js +1 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +17 -15
- package/src/loader/loadingscreen.js +1 -2
- package/src/math/color.js +23 -24
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +24 -25
- package/src/math/matrix3.js +26 -27
- package/src/math/observable_vector2.js +46 -35
- package/src/math/observable_vector3.js +54 -36
- package/src/math/vector2.js +58 -47
- package/src/math/vector3.js +66 -48
- package/src/particles/emitter.js +64 -72
- package/src/particles/particle.js +3 -4
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +38 -39
- package/src/physics/bounds.js +30 -32
- package/src/physics/collision.js +6 -6
- package/src/physics/detector.js +3 -3
- package/src/physics/quadtree.js +8 -9
- package/src/physics/sat.js +4 -4
- package/src/physics/world.js +11 -12
- package/src/plugin/plugin.js +6 -7
- package/src/renderable/GUI.js +7 -8
- package/src/renderable/collectable.js +3 -4
- package/src/renderable/colorlayer.js +7 -8
- package/src/renderable/container.js +36 -37
- package/src/renderable/imagelayer.js +4 -5
- package/src/renderable/nineslicesprite.js +2 -3
- package/src/renderable/renderable.js +45 -46
- package/src/renderable/sprite.js +16 -17
- package/src/renderable/trigger.js +4 -5
- package/src/state/stage.js +8 -9
- package/src/state/state.js +24 -24
- package/src/system/device.js +41 -97
- package/src/system/event.js +45 -33
- package/src/system/pooling.js +1 -1
- package/src/system/save.js +3 -3
- package/src/system/timer.js +13 -13
- package/src/text/bitmaptext.js +12 -13
- package/src/text/bitmaptextdata.js +5 -6
- package/src/text/text.js +16 -17
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +14 -15
- package/src/utils/agent.js +3 -3
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +3 -3
- package/src/utils/function.js +3 -3
- package/src/utils/string.js +7 -7
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +39 -40
- package/src/video/renderer.js +29 -30
- package/src/video/texture.js +8 -9
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +7 -7
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/glshader.js +11 -12
- package/src/video/webgl/webgl_compositor.js +118 -90
- package/src/video/webgl/webgl_renderer.js +95 -74
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"keywords": [
|
|
@@ -60,32 +60,32 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@rollup/plugin-buble": "^0.21.3",
|
|
62
62
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
63
|
-
"@rollup/plugin-node-resolve": "^13.1.
|
|
64
|
-
"@rollup/plugin-replace": "^3.0.
|
|
63
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
64
|
+
"@rollup/plugin-replace": "^3.0.1",
|
|
65
65
|
"cheerio": "^1.0.0-rc.10",
|
|
66
66
|
"del-cli": "^4.0.1",
|
|
67
|
-
"eslint": "^8.
|
|
68
|
-
"eslint-plugin-jsdoc": "^37.
|
|
69
|
-
"jasmine-core": "^
|
|
70
|
-
"jsdoc": "^3.6.
|
|
71
|
-
"karma": "^6.3.
|
|
67
|
+
"eslint": "^8.8.0",
|
|
68
|
+
"eslint-plugin-jsdoc": "^37.7.0",
|
|
69
|
+
"jasmine-core": "^4.0.0",
|
|
70
|
+
"jsdoc": "^3.6.10",
|
|
71
|
+
"karma": "^6.3.13",
|
|
72
72
|
"karma-chrome-launcher": "^3.1.0",
|
|
73
73
|
"karma-coverage": "^2.1.0",
|
|
74
74
|
"karma-html-detailed-reporter": "^2.1.0",
|
|
75
75
|
"karma-jasmine": "^4.0.1",
|
|
76
76
|
"karma-nyan-reporter": "0.2.5",
|
|
77
|
-
"qs": "^6.10.
|
|
78
|
-
"rollup": "^2.
|
|
77
|
+
"qs": "^6.10.3",
|
|
78
|
+
"rollup": "^2.67.0",
|
|
79
79
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
80
80
|
"rollup-plugin-string": "^3.0.0",
|
|
81
81
|
"terser": "^5.10.0",
|
|
82
|
-
"typescript": "^4.5.
|
|
82
|
+
"typescript": "^4.5.5"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "npm run lint && rollup -c --silent",
|
|
86
86
|
"dist": " npm run build && npm run minify && mkdirp dist && cp -f build/*.js dist/ && npm run makedts",
|
|
87
87
|
"minify": "terser build/melonjs.js --compress --mangle --comments '/(?:^!|@(?:license|preserve|cc_on))/' --output build/melonjs.min.js",
|
|
88
|
-
"lint": "eslint --config .eslintrc.json src",
|
|
88
|
+
"lint": "eslint --config .eslintrc.json src rollup.config.js",
|
|
89
89
|
"test": "npm run build && karma start tests/karma.conf.js",
|
|
90
90
|
"doc": "mkdirp docs && jsdoc -c jsdoc_conf.json",
|
|
91
91
|
"release": "npm run dist && npm publish --access public",
|
package/src/audio/audio.js
CHANGED
|
@@ -5,7 +5,7 @@ import loader from "./../loader/loader.js";
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @namespace audio
|
|
8
|
-
* @
|
|
8
|
+
* @memberof me
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -70,7 +70,7 @@ var soundLoadError = function (sound_name, onerror_cb) {
|
|
|
70
70
|
* @name stopOnAudioError
|
|
71
71
|
* @type {boolean}
|
|
72
72
|
* @default true
|
|
73
|
-
* @
|
|
73
|
+
* @memberof me.audio
|
|
74
74
|
*/
|
|
75
75
|
export let stopOnAudioError = true;
|
|
76
76
|
|
|
@@ -241,7 +241,7 @@ export function fade(sound_name, from, to, duration, id) {
|
|
|
241
241
|
* get/set the position of playback for a sound.
|
|
242
242
|
* @function me.audio.seek
|
|
243
243
|
* @param {string} sound_name audio clip name - case sensitive
|
|
244
|
-
* @param {number} [seek]
|
|
244
|
+
* @param {number} [seek] the position to move current playback to (in seconds).
|
|
245
245
|
* @param {number} [id] the sound instance ID. If none is passed, all sounds in group will changed.
|
|
246
246
|
* @returns {number} return the current seek position (if no extra parameters were given)
|
|
247
247
|
* @example
|
package/src/camera/camera2d.js
CHANGED
|
@@ -4,7 +4,7 @@ import ObservableVector2d from "./../math/observable_vector2.js";
|
|
|
4
4
|
import ObservableVector3d from "./../math/observable_vector3.js";
|
|
5
5
|
import Matrix2d from "./../math/matrix2.js";
|
|
6
6
|
import Matrix3d from "./../math/matrix3.js";
|
|
7
|
-
import Rect from "./../
|
|
7
|
+
import Rect from "./../geometries/rectangle.js";
|
|
8
8
|
import { renderer } from "./../video/video.js";
|
|
9
9
|
import * as event from "./../system/event.js";
|
|
10
10
|
import pool from "./../system/pooling.js";
|
|
@@ -22,9 +22,8 @@ var targetV = new Vector2d();
|
|
|
22
22
|
* @classdesc
|
|
23
23
|
* a 2D orthographic camera
|
|
24
24
|
* @class Camera2d
|
|
25
|
-
* @
|
|
26
|
-
* @
|
|
27
|
-
* @constructor
|
|
25
|
+
* @augments me.Renderable
|
|
26
|
+
* @memberof me
|
|
28
27
|
* @param {number} minX start x offset
|
|
29
28
|
* @param {number} minY start y offset
|
|
30
29
|
* @param {number} maxX end x offset
|
|
@@ -48,7 +47,7 @@ class Camera2d extends Renderable {
|
|
|
48
47
|
* @constant
|
|
49
48
|
* @enum {number}
|
|
50
49
|
* @name AXIS
|
|
51
|
-
* @
|
|
50
|
+
* @memberof me.Camera2d
|
|
52
51
|
*/
|
|
53
52
|
this.AXIS = {
|
|
54
53
|
NONE : 0,
|
|
@@ -62,7 +61,7 @@ class Camera2d extends Renderable {
|
|
|
62
61
|
* @public
|
|
63
62
|
* @type {me.Bounds}
|
|
64
63
|
* @name bounds
|
|
65
|
-
* @
|
|
64
|
+
* @memberof me.Camera2d
|
|
66
65
|
*/
|
|
67
66
|
this.bounds = pool.pull("Bounds");
|
|
68
67
|
|
|
@@ -73,7 +72,7 @@ class Camera2d extends Renderable {
|
|
|
73
72
|
* @name smoothFollow
|
|
74
73
|
* @see me.Camera2d.damping
|
|
75
74
|
* @default true
|
|
76
|
-
* @
|
|
75
|
+
* @memberof me.Camera2d
|
|
77
76
|
*/
|
|
78
77
|
this.smoothFollow = true;
|
|
79
78
|
|
|
@@ -84,7 +83,7 @@ class Camera2d extends Renderable {
|
|
|
84
83
|
* @type {number}
|
|
85
84
|
* @name damping
|
|
86
85
|
* @default 1.0
|
|
87
|
-
* @
|
|
86
|
+
* @memberof me.Camera2d
|
|
88
87
|
*/
|
|
89
88
|
this.damping = 1.0;
|
|
90
89
|
|
|
@@ -94,7 +93,7 @@ class Camera2d extends Renderable {
|
|
|
94
93
|
* @type {number}
|
|
95
94
|
* @name near
|
|
96
95
|
* @default -1000
|
|
97
|
-
* @
|
|
96
|
+
* @memberof me.Camera2d
|
|
98
97
|
*/
|
|
99
98
|
this.near = -1000;
|
|
100
99
|
|
|
@@ -104,7 +103,7 @@ class Camera2d extends Renderable {
|
|
|
104
103
|
* @type {number}
|
|
105
104
|
* @name far
|
|
106
105
|
* @default 1000
|
|
107
|
-
* @
|
|
106
|
+
* @memberof me.Camera2d
|
|
108
107
|
*/
|
|
109
108
|
this.far = 1000;
|
|
110
109
|
|
|
@@ -114,7 +113,7 @@ class Camera2d extends Renderable {
|
|
|
114
113
|
* @public
|
|
115
114
|
* @type {me.Matrix3d}
|
|
116
115
|
* @name projectionMatrix
|
|
117
|
-
* @
|
|
116
|
+
* @memberof me.Camera2d
|
|
118
117
|
*/
|
|
119
118
|
this.projectionMatrix = new Matrix3d();
|
|
120
119
|
|
|
@@ -123,7 +122,7 @@ class Camera2d extends Renderable {
|
|
|
123
122
|
* @ignore
|
|
124
123
|
* @type {me.Matrix2d}
|
|
125
124
|
* @name invCurrentTransform
|
|
126
|
-
* @
|
|
125
|
+
* @memberof me.Camera2d
|
|
127
126
|
*/
|
|
128
127
|
this.invCurrentTransform = new Matrix2d();
|
|
129
128
|
|
|
@@ -216,7 +215,7 @@ class Camera2d extends Renderable {
|
|
|
216
215
|
/**
|
|
217
216
|
* reset the camera position to specified coordinates
|
|
218
217
|
* @name reset
|
|
219
|
-
* @
|
|
218
|
+
* @memberof me.Camera2d
|
|
220
219
|
* @function
|
|
221
220
|
* @param {number} [x=0]
|
|
222
221
|
* @param {number} [y=0]
|
|
@@ -247,7 +246,7 @@ class Camera2d extends Renderable {
|
|
|
247
246
|
* the followed renderable can move without scrolling the camera.
|
|
248
247
|
* @name setDeadzone
|
|
249
248
|
* @see me.Camera2d.follow
|
|
250
|
-
* @
|
|
249
|
+
* @memberof me.Camera2d
|
|
251
250
|
* @function
|
|
252
251
|
* @param {number} w deadzone width
|
|
253
252
|
* @param {number} h deadzone height
|
|
@@ -275,7 +274,7 @@ class Camera2d extends Renderable {
|
|
|
275
274
|
/**
|
|
276
275
|
* resize the camera
|
|
277
276
|
* @name resize
|
|
278
|
-
* @
|
|
277
|
+
* @memberof me.Camera2d
|
|
279
278
|
* @function
|
|
280
279
|
* @param {number} w new width of the camera
|
|
281
280
|
* @param {number} h new height of the camera
|
|
@@ -307,7 +306,7 @@ class Camera2d extends Renderable {
|
|
|
307
306
|
* set the camera boundaries (set to the world limit by default).
|
|
308
307
|
* the camera is bound to the given coordinates and cannot move/be scrolled outside of it.
|
|
309
308
|
* @name setBounds
|
|
310
|
-
* @
|
|
309
|
+
* @memberof me.Camera2d
|
|
311
310
|
* @function
|
|
312
311
|
* @param {number} x world left limit
|
|
313
312
|
* @param {number} y world top limit
|
|
@@ -326,7 +325,7 @@ class Camera2d extends Renderable {
|
|
|
326
325
|
* set the camera to follow the specified renderable. <br>
|
|
327
326
|
* (this will put the camera center around the given target)
|
|
328
327
|
* @name follow
|
|
329
|
-
* @
|
|
328
|
+
* @memberof me.Camera2d
|
|
330
329
|
* @function
|
|
331
330
|
* @param {me.Renderable|me.Vector2d} target renderable or position vector to follow
|
|
332
331
|
* @param {me.Camera2d.AXIS} [axis=this.AXIS.BOTH] Which axis to follow
|
|
@@ -368,7 +367,7 @@ class Camera2d extends Renderable {
|
|
|
368
367
|
/**
|
|
369
368
|
* unfollow the current target
|
|
370
369
|
* @name unfollow
|
|
371
|
-
* @
|
|
370
|
+
* @memberof me.Camera2d
|
|
372
371
|
* @function
|
|
373
372
|
*/
|
|
374
373
|
unfollow() {
|
|
@@ -379,7 +378,7 @@ class Camera2d extends Renderable {
|
|
|
379
378
|
/**
|
|
380
379
|
* move the camera upper-left position by the specified offset.
|
|
381
380
|
* @name move
|
|
382
|
-
* @
|
|
381
|
+
* @memberof me.Camera2d
|
|
383
382
|
* @see me.Camera2d.focusOn
|
|
384
383
|
* @function
|
|
385
384
|
* @param {number} x
|
|
@@ -395,7 +394,7 @@ class Camera2d extends Renderable {
|
|
|
395
394
|
/**
|
|
396
395
|
* move the camera upper-left position to the specified coordinates
|
|
397
396
|
* @name moveTo
|
|
398
|
-
* @
|
|
397
|
+
* @memberof me.Camera2d
|
|
399
398
|
* @see me.Camera2d.focusOn
|
|
400
399
|
* @function
|
|
401
400
|
* @param {number} x
|
|
@@ -519,7 +518,7 @@ class Camera2d extends Renderable {
|
|
|
519
518
|
/**
|
|
520
519
|
* shake the camera
|
|
521
520
|
* @name shake
|
|
522
|
-
* @
|
|
521
|
+
* @memberof me.Camera2d
|
|
523
522
|
* @function
|
|
524
523
|
* @param {number} intensity maximum offset that the screen can be moved
|
|
525
524
|
* while shaking
|
|
@@ -545,7 +544,7 @@ class Camera2d extends Renderable {
|
|
|
545
544
|
* fadeOut(flash) effect<p>
|
|
546
545
|
* screen is filled with the specified color and slowly goes back to normal
|
|
547
546
|
* @name fadeOut
|
|
548
|
-
* @
|
|
547
|
+
* @memberof me.Camera2d
|
|
549
548
|
* @function
|
|
550
549
|
* @param {me.Color|string} color a CSS color value
|
|
551
550
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
@@ -571,7 +570,7 @@ class Camera2d extends Renderable {
|
|
|
571
570
|
* fadeIn effect <p>
|
|
572
571
|
* fade to the specified color
|
|
573
572
|
* @name fadeIn
|
|
574
|
-
* @
|
|
573
|
+
* @memberof me.Camera2d
|
|
575
574
|
* @function
|
|
576
575
|
* @param {me.Color|string} color a CSS color value
|
|
577
576
|
* @param {number} [duration=1000] expressed in milliseconds
|
|
@@ -594,7 +593,7 @@ class Camera2d extends Renderable {
|
|
|
594
593
|
/**
|
|
595
594
|
* set the camera position around the specified object
|
|
596
595
|
* @name focusOn
|
|
597
|
-
* @
|
|
596
|
+
* @memberof me.Camera2d
|
|
598
597
|
* @function
|
|
599
598
|
* @param {me.Renderable} target the renderable to focus the camera on
|
|
600
599
|
*/
|
|
@@ -609,7 +608,7 @@ class Camera2d extends Renderable {
|
|
|
609
608
|
/**
|
|
610
609
|
* check if the specified renderable is in the camera
|
|
611
610
|
* @name isVisible
|
|
612
|
-
* @
|
|
611
|
+
* @memberof me.Camera2d
|
|
613
612
|
* @function
|
|
614
613
|
* @param {me.Renderable} obj to be checked against
|
|
615
614
|
* @param {boolean} [floating = obj.floating] if visibility check should be done against screen coordinates
|
|
@@ -628,7 +627,7 @@ class Camera2d extends Renderable {
|
|
|
628
627
|
/**
|
|
629
628
|
* convert the given "local" (screen) coordinates into world coordinates
|
|
630
629
|
* @name localToWorld
|
|
631
|
-
* @
|
|
630
|
+
* @memberof me.Camera2d
|
|
632
631
|
* @function
|
|
633
632
|
* @param {number} x
|
|
634
633
|
* @param {number} y
|
|
@@ -649,7 +648,7 @@ class Camera2d extends Renderable {
|
|
|
649
648
|
/**
|
|
650
649
|
* convert the given world coordinates into "local" (screen) coordinates
|
|
651
650
|
* @name worldToLocal
|
|
652
|
-
* @
|
|
651
|
+
* @memberof me.Camera2d
|
|
653
652
|
* @function
|
|
654
653
|
* @param {number} x
|
|
655
654
|
* @param {number} y
|
package/src/entity/draggable.js
CHANGED
|
@@ -4,26 +4,17 @@ import * as event from "./../system/event.js";
|
|
|
4
4
|
import Entity from "./entity.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* @classdesc
|
|
7
8
|
* Used to make a game entity draggable
|
|
8
|
-
* @class
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
* @constructor
|
|
9
|
+
* @class DraggableEntity
|
|
10
|
+
* @augments me.Entity
|
|
11
|
+
* @memberof me
|
|
12
12
|
* @param {number} x the x coordinates of the entity object
|
|
13
13
|
* @param {number} y the y coordinates of the entity object
|
|
14
14
|
* @param {object} settings Entity properties (see {@link me.Entity})
|
|
15
15
|
*/
|
|
16
16
|
class DraggableEntity extends Entity {
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Constructor
|
|
20
|
-
* @name init
|
|
21
|
-
* @memberOf me.DraggableEntity
|
|
22
|
-
* @function
|
|
23
|
-
* @param {number} x the x postion of the entity
|
|
24
|
-
* @param {number} y the y postion of the entity
|
|
25
|
-
* @param {object} settings the additional entity settings
|
|
26
|
-
*/
|
|
27
18
|
constructor(x, y, settings) {
|
|
28
19
|
super(x, y, settings);
|
|
29
20
|
this.dragging = false;
|
|
@@ -41,7 +32,7 @@ class DraggableEntity extends Entity {
|
|
|
41
32
|
* this module testable. Then we subscribe this module to the
|
|
42
33
|
* transformed events.
|
|
43
34
|
* @name initEvents
|
|
44
|
-
* @
|
|
35
|
+
* @memberof me.DraggableEntity
|
|
45
36
|
* @function
|
|
46
37
|
*/
|
|
47
38
|
initEvents() {
|
|
@@ -68,7 +59,7 @@ class DraggableEntity extends Entity {
|
|
|
68
59
|
/**
|
|
69
60
|
* Translates a pointer event to a me.event
|
|
70
61
|
* @name translatePointerEvent
|
|
71
|
-
* @
|
|
62
|
+
* @memberof me.DraggableEntity
|
|
72
63
|
* @function
|
|
73
64
|
* @param {object} e the pointer event you want to translate
|
|
74
65
|
* @param {string} translation the me.event you want to translate the event to
|
|
@@ -80,7 +71,7 @@ class DraggableEntity extends Entity {
|
|
|
80
71
|
/**
|
|
81
72
|
* Gets called when the user starts dragging the entity
|
|
82
73
|
* @name dragStart
|
|
83
|
-
* @
|
|
74
|
+
* @memberof me.DraggableEntity
|
|
84
75
|
* @function
|
|
85
76
|
* @param {object} e the pointer event
|
|
86
77
|
* @returns {boolean} false if the object is being dragged
|
|
@@ -97,7 +88,7 @@ class DraggableEntity extends Entity {
|
|
|
97
88
|
/**
|
|
98
89
|
* Gets called when the user drags this entity around
|
|
99
90
|
* @name dragMove
|
|
100
|
-
* @
|
|
91
|
+
* @memberof me.DraggableEntity
|
|
101
92
|
* @function
|
|
102
93
|
* @param {object} e the pointer event
|
|
103
94
|
*/
|
|
@@ -111,7 +102,7 @@ class DraggableEntity extends Entity {
|
|
|
111
102
|
/**
|
|
112
103
|
* Gets called when the user stops dragging the entity
|
|
113
104
|
* @name dragEnd
|
|
114
|
-
* @
|
|
105
|
+
* @memberof me.DraggableEntity
|
|
115
106
|
* @function
|
|
116
107
|
* @returns {boolean} false if the object stopped being dragged
|
|
117
108
|
*/
|
|
@@ -125,7 +116,7 @@ class DraggableEntity extends Entity {
|
|
|
125
116
|
/**
|
|
126
117
|
* Destructor
|
|
127
118
|
* @name destroy
|
|
128
|
-
* @
|
|
119
|
+
* @memberof me.DraggableEntity
|
|
129
120
|
* @function
|
|
130
121
|
*/
|
|
131
122
|
destroy() {
|
package/src/entity/droptarget.js
CHANGED
|
@@ -2,26 +2,18 @@ import * as event from "./../system/event.js";
|
|
|
2
2
|
import Entity from "./entity.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* @classdesc
|
|
5
6
|
* Used to make a game entity a droptarget
|
|
6
|
-
* @class
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
9
|
-
* @constructor
|
|
7
|
+
* @class DroptargetEntity
|
|
8
|
+
* @augments me.Entity
|
|
9
|
+
* @memberof me
|
|
10
10
|
* @param {number} x the x coordinates of the entity object
|
|
11
11
|
* @param {number} y the y coordinates of the entity object
|
|
12
12
|
* @param {object} settings Entity properties (see {@link me.Entity})
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
class DroptargetEntity extends Entity {
|
|
16
|
-
|
|
17
|
-
* Constructor
|
|
18
|
-
* @name init
|
|
19
|
-
* @memberOf me.DroptargetEntity
|
|
20
|
-
* @function
|
|
21
|
-
* @param {number} x the x postion of the entity
|
|
22
|
-
* @param {number} y the y postion of the entity
|
|
23
|
-
* @param {object} settings the additional entity settings
|
|
24
|
-
*/
|
|
16
|
+
|
|
25
17
|
constructor(x, y, settings) {
|
|
26
18
|
super(x, y, settings);
|
|
27
19
|
/**
|
|
@@ -30,7 +22,7 @@ class DroptargetEntity extends Entity {
|
|
|
30
22
|
* @constant
|
|
31
23
|
* @type {string}
|
|
32
24
|
* @name CHECKMETHOD_OVERLAP
|
|
33
|
-
* @
|
|
25
|
+
* @memberof me.DroptargetEntity
|
|
34
26
|
*/
|
|
35
27
|
this.CHECKMETHOD_OVERLAP = "overlaps";
|
|
36
28
|
/**
|
|
@@ -39,7 +31,7 @@ class DroptargetEntity extends Entity {
|
|
|
39
31
|
* @constant
|
|
40
32
|
* @type {string}
|
|
41
33
|
* @name CHECKMETHOD_CONTAINS
|
|
42
|
-
* @
|
|
34
|
+
* @memberof me.DroptargetEntity
|
|
43
35
|
*/
|
|
44
36
|
this.CHECKMETHOD_CONTAINS = "contains";
|
|
45
37
|
/**
|
|
@@ -48,7 +40,7 @@ class DroptargetEntity extends Entity {
|
|
|
48
40
|
* @constant
|
|
49
41
|
* @type {string}
|
|
50
42
|
* @name checkMethod
|
|
51
|
-
* @
|
|
43
|
+
* @memberof me.DroptargetEntity
|
|
52
44
|
*/
|
|
53
45
|
this.checkMethod = null;
|
|
54
46
|
event.on(event.DRAGEND, this.checkOnMe, this);
|
|
@@ -58,7 +50,7 @@ class DroptargetEntity extends Entity {
|
|
|
58
50
|
/**
|
|
59
51
|
* Sets the collision method which is going to be used to check a valid drop
|
|
60
52
|
* @name setCheckMethod
|
|
61
|
-
* @
|
|
53
|
+
* @memberof me.DroptargetEntity
|
|
62
54
|
* @function
|
|
63
55
|
* @param {string} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
|
|
64
56
|
*/
|
|
@@ -73,7 +65,7 @@ class DroptargetEntity extends Entity {
|
|
|
73
65
|
/**
|
|
74
66
|
* Checks if a dropped entity is dropped on the current entity
|
|
75
67
|
* @name checkOnMe
|
|
76
|
-
* @
|
|
68
|
+
* @memberof me.DroptargetEntity
|
|
77
69
|
* @function
|
|
78
70
|
* @param {object} e the triggering event
|
|
79
71
|
* @param {object} draggableEntity the draggable entity that is dropped
|
|
@@ -88,7 +80,7 @@ class DroptargetEntity extends Entity {
|
|
|
88
80
|
/**
|
|
89
81
|
* Gets called when a draggable entity is dropped on the current entity
|
|
90
82
|
* @name drop
|
|
91
|
-
* @
|
|
83
|
+
* @memberof me.DroptargetEntity
|
|
92
84
|
* @function
|
|
93
85
|
* @param {object} draggableEntity the draggable entity that is dropped
|
|
94
86
|
*/
|
|
@@ -99,7 +91,7 @@ class DroptargetEntity extends Entity {
|
|
|
99
91
|
/**
|
|
100
92
|
* Destructor
|
|
101
93
|
* @name destroy
|
|
102
|
-
* @
|
|
94
|
+
* @memberof me.DroptargetEntity
|
|
103
95
|
* @function
|
|
104
96
|
*/
|
|
105
97
|
destroy() {
|
package/src/entity/entity.js
CHANGED
|
@@ -2,16 +2,16 @@ import Vector2d from "./../math/vector2.js";
|
|
|
2
2
|
import Renderable from "./../renderable/renderable.js";
|
|
3
3
|
import Sprite from "./../renderable/sprite.js";
|
|
4
4
|
import Body from "./../physics/body.js";
|
|
5
|
-
import Polygon from "./../
|
|
5
|
+
import Polygon from "./../geometries/poly.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
+
* @classdesc
|
|
9
10
|
* a Generic Object Entity
|
|
10
11
|
* @class Entity
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
12
|
+
* @augments me.Renderable
|
|
13
|
+
* @memberof me
|
|
13
14
|
* @see me.Renderable
|
|
14
|
-
* @constructor
|
|
15
15
|
* @param {number} x the x coordinates of the entity object
|
|
16
16
|
* @param {number} y the y coordinates of the entity object
|
|
17
17
|
* @param {object} settings Entity properties, to be defined through Tiled or when calling the entity constructor
|
|
@@ -76,7 +76,7 @@ class Entity extends Renderable {
|
|
|
76
76
|
* @public
|
|
77
77
|
* @type {string}
|
|
78
78
|
* @name type
|
|
79
|
-
* @
|
|
79
|
+
* @memberof me.Entity
|
|
80
80
|
*/
|
|
81
81
|
this.type = settings.type || "";
|
|
82
82
|
|
|
@@ -85,7 +85,7 @@ class Entity extends Renderable {
|
|
|
85
85
|
* @public
|
|
86
86
|
* @type {number}
|
|
87
87
|
* @name id
|
|
88
|
-
* @
|
|
88
|
+
* @memberof me.Entity
|
|
89
89
|
*/
|
|
90
90
|
this.id = settings.id || "";
|
|
91
91
|
|
|
@@ -95,7 +95,7 @@ class Entity extends Renderable {
|
|
|
95
95
|
* @public
|
|
96
96
|
* @type {boolean}
|
|
97
97
|
* @name alive
|
|
98
|
-
* @
|
|
98
|
+
* @memberof me.Entity
|
|
99
99
|
*/
|
|
100
100
|
this.alive = true;
|
|
101
101
|
|
|
@@ -104,7 +104,7 @@ class Entity extends Renderable {
|
|
|
104
104
|
* @public
|
|
105
105
|
* @type {me.Body}
|
|
106
106
|
* @name body
|
|
107
|
-
* @
|
|
107
|
+
* @memberof me.Entity
|
|
108
108
|
*/
|
|
109
109
|
// initialize the default body
|
|
110
110
|
if (typeof settings.shapes === "undefined") {
|
|
@@ -136,7 +136,7 @@ class Entity extends Renderable {
|
|
|
136
136
|
* @public
|
|
137
137
|
* @type {me.Renderable}
|
|
138
138
|
* @name renderable
|
|
139
|
-
* @
|
|
139
|
+
* @memberof me.Entity
|
|
140
140
|
*/
|
|
141
141
|
|
|
142
142
|
get renderable() {
|
|
@@ -164,9 +164,9 @@ class Entity extends Renderable {
|
|
|
164
164
|
* update the bounds position when the body is modified
|
|
165
165
|
* @ignore
|
|
166
166
|
* @name onBodyUpdate
|
|
167
|
-
* @
|
|
167
|
+
* @memberof me.Entity
|
|
168
168
|
* @function
|
|
169
|
-
* @param {me.Body} the body whose bounds to update
|
|
169
|
+
* @param {me.Body} body the body whose bounds to update
|
|
170
170
|
*/
|
|
171
171
|
onBodyUpdate(body) {
|
|
172
172
|
// update the entity bounds to include the body bounds
|
|
@@ -200,7 +200,7 @@ class Entity extends Renderable {
|
|
|
200
200
|
* not to be called by the end user<br>
|
|
201
201
|
* called by the game manager on each game loop
|
|
202
202
|
* @name draw
|
|
203
|
-
* @
|
|
203
|
+
* @memberof me.Entity
|
|
204
204
|
* @function
|
|
205
205
|
* @protected
|
|
206
206
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
@@ -239,7 +239,7 @@ class Entity extends Renderable {
|
|
|
239
239
|
* onDeactivateEvent Notification function<br>
|
|
240
240
|
* Called by engine before deleting the object
|
|
241
241
|
* @name onDeactivateEvent
|
|
242
|
-
* @
|
|
242
|
+
* @memberof me.Entity
|
|
243
243
|
* @function
|
|
244
244
|
*/
|
|
245
245
|
onDeactivateEvent() {
|
package/src/game.js
CHANGED
|
@@ -9,7 +9,7 @@ import World from "./physics/world.js";
|
|
|
9
9
|
* tilemap layers, current viewport, collision map, etc...<br>
|
|
10
10
|
* me.game is also responsible for updating (each frame) the object status and draw them.
|
|
11
11
|
* @namespace me.game
|
|
12
|
-
* @
|
|
12
|
+
* @memberof me
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// to know when we have to refresh the display
|
|
@@ -49,7 +49,7 @@ event.on(event.BOOT, () => {
|
|
|
49
49
|
* @public
|
|
50
50
|
* @type {me.Camera2d}
|
|
51
51
|
* @name viewport
|
|
52
|
-
* @
|
|
52
|
+
* @memberof me.game
|
|
53
53
|
*/
|
|
54
54
|
export let viewport;
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ export let viewport;
|
|
|
59
59
|
* @public
|
|
60
60
|
* @type {me.World}
|
|
61
61
|
* @name world
|
|
62
|
-
* @
|
|
62
|
+
* @memberof me.game
|
|
63
63
|
*/
|
|
64
64
|
export let world;
|
|
65
65
|
|
|
@@ -70,7 +70,7 @@ export let world;
|
|
|
70
70
|
* @type {boolean}
|
|
71
71
|
* @default true
|
|
72
72
|
* @name mergeGroup
|
|
73
|
-
* @
|
|
73
|
+
* @memberof me.game
|
|
74
74
|
*/
|
|
75
75
|
export let mergeGroup = true;
|
|
76
76
|
|
|
@@ -81,7 +81,7 @@ export let mergeGroup = true;
|
|
|
81
81
|
* @type {string}
|
|
82
82
|
* @default "z"
|
|
83
83
|
* @name sortOn
|
|
84
|
-
* @
|
|
84
|
+
* @memberof me.game
|
|
85
85
|
*/
|
|
86
86
|
export let sortOn = "z";
|
|
87
87
|
|
|
@@ -93,7 +93,7 @@ export let sortOn = "z";
|
|
|
93
93
|
* @public
|
|
94
94
|
* @type {DOMHighResTimeStamp}
|
|
95
95
|
* @name lastUpdate
|
|
96
|
-
* @
|
|
96
|
+
* @memberof me.game
|
|
97
97
|
*/
|
|
98
98
|
export let lastUpdate = window.performance.now();
|
|
99
99
|
|