melonjs 10.2.0 → 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/README.md +1 -1
- package/dist/melonjs.js +4435 -4283
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3348 -3833
- package/dist/melonjs.module.js +4025 -3920
- package/package.json +13 -14
- package/src/audio/audio.js +45 -45
- package/src/camera/camera2d.js +78 -101
- package/src/entity/draggable.js +21 -29
- package/src/entity/droptarget.js +24 -31
- package/src/entity/entity.js +34 -38
- package/src/game.js +8 -8
- package/src/{shapes → geometries}/ellipse.js +46 -46
- package/src/{shapes → geometries}/line.js +14 -14
- package/src/{shapes → geometries}/poly.js +103 -54
- package/src/{shapes → geometries}/rectangle.js +73 -120
- package/src/index.js +18 -19
- package/src/input/gamepad.js +20 -20
- package/src/input/input.js +3 -3
- package/src/input/keyboard.js +122 -124
- package/src/input/pointer.js +102 -62
- package/src/input/pointerevent.js +97 -42
- package/src/lang/deprecated.js +29 -18
- package/src/level/level.js +34 -26
- package/src/level/tiled/TMXGroup.js +12 -13
- package/src/level/tiled/TMXLayer.js +41 -42
- package/src/level/tiled/TMXObject.js +76 -70
- package/src/level/tiled/TMXTile.js +13 -15
- package/src/level/tiled/TMXTileMap.js +26 -25
- package/src/level/tiled/TMXTileset.js +14 -15
- package/src/level/tiled/TMXTilesetGroup.js +5 -6
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +18 -19
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +46 -40
- package/src/loader/loadingscreen.js +7 -7
- package/src/math/color.js +68 -88
- package/src/math/math.js +33 -33
- package/src/math/matrix2.js +70 -71
- package/src/math/matrix3.js +90 -91
- package/src/math/observable_vector2.js +91 -92
- package/src/math/observable_vector3.js +110 -106
- package/src/math/vector2.js +116 -104
- package/src/math/vector3.js +129 -110
- package/src/particles/emitter.js +116 -126
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +82 -83
- package/src/physics/bounds.js +64 -66
- package/src/physics/collision.js +21 -22
- package/src/physics/detector.js +13 -13
- package/src/physics/quadtree.js +26 -25
- package/src/physics/sat.js +21 -21
- package/src/physics/world.js +23 -22
- package/src/plugin/plugin.js +12 -13
- package/src/renderable/GUI.js +20 -26
- package/src/renderable/collectable.js +6 -7
- package/src/renderable/colorlayer.js +11 -12
- package/src/renderable/container.js +98 -81
- package/src/renderable/imagelayer.js +33 -35
- package/src/renderable/nineslicesprite.js +15 -16
- package/src/renderable/renderable.js +112 -111
- package/src/renderable/sprite.js +71 -58
- package/src/renderable/trigger.js +17 -19
- package/src/state/stage.js +14 -15
- package/src/state/state.js +78 -78
- package/src/system/device.js +137 -180
- package/src/system/event.js +116 -104
- package/src/system/pooling.js +15 -15
- package/src/system/save.js +9 -6
- package/src/system/timer.js +33 -33
- package/src/text/bitmaptext.js +39 -46
- package/src/text/bitmaptextdata.js +14 -15
- package/src/text/text.js +55 -58
- package/src/tweens/easing.js +5 -5
- package/src/tweens/interpolation.js +5 -5
- package/src/tweens/tween.js +49 -40
- package/src/utils/agent.js +12 -11
- package/src/utils/array.js +8 -8
- package/src/utils/file.js +7 -7
- package/src/utils/function.js +8 -8
- package/src/utils/string.js +19 -19
- package/src/utils/utils.js +23 -23
- package/src/video/canvas/canvas_renderer.js +127 -128
- package/src/video/renderer.js +69 -69
- package/src/video/texture.js +80 -82
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +38 -38
- package/src/video/webgl/buffer/vertex.js +11 -3
- package/src/video/webgl/glshader.js +31 -32
- package/src/video/webgl/webgl_compositor.js +145 -127
- package/src/video/webgl/webgl_renderer.js +196 -175
package/src/particles/emitter.js
CHANGED
|
@@ -16,192 +16,192 @@ var pixel = (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* me.ParticleEmitterSettings contains the default settings for me.ParticleEmitter
|
|
20
|
-
* @
|
|
19
|
+
* me.ParticleEmitterSettings contains the default settings for me.ParticleEmitter
|
|
20
|
+
* @ignore
|
|
21
21
|
* @class
|
|
22
|
-
* @
|
|
22
|
+
* @memberof me
|
|
23
23
|
* @see me.ParticleEmitter
|
|
24
24
|
*/
|
|
25
25
|
var ParticleEmitterSettings = {
|
|
26
26
|
/**
|
|
27
27
|
* Width of the particle spawn area.<br>
|
|
28
28
|
* @public
|
|
29
|
-
* @type
|
|
29
|
+
* @type {number}
|
|
30
30
|
* @name width
|
|
31
|
-
* @
|
|
31
|
+
* @memberof me.ParticleEmitterSettings
|
|
32
32
|
* @default 0
|
|
33
33
|
*/
|
|
34
34
|
width : 0,
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Height of the particle spawn area
|
|
37
|
+
* Height of the particle spawn area
|
|
38
38
|
* @public
|
|
39
|
-
* @type
|
|
39
|
+
* @type {number}
|
|
40
40
|
* @name height
|
|
41
|
-
* @
|
|
41
|
+
* @memberof me.ParticleEmitterSettings
|
|
42
42
|
* @default 0
|
|
43
43
|
*/
|
|
44
44
|
height : 0,
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Image used for particles
|
|
47
|
+
* Image used for particles
|
|
48
48
|
* @public
|
|
49
|
-
* @type CanvasImageSource
|
|
49
|
+
* @type {CanvasImageSource}
|
|
50
50
|
* @name image
|
|
51
|
-
* @
|
|
51
|
+
* @memberof me.ParticleEmitterSettings
|
|
52
52
|
* @default 1x1 white pixel
|
|
53
53
|
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvasimagesource
|
|
54
54
|
*/
|
|
55
55
|
image : pixel,
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Total number of particles in the emitter
|
|
58
|
+
* Total number of particles in the emitter
|
|
59
59
|
* @public
|
|
60
|
-
* @type
|
|
60
|
+
* @type {number}
|
|
61
61
|
* @name totalParticles
|
|
62
62
|
* @default 50
|
|
63
|
-
* @
|
|
63
|
+
* @memberof me.ParticleEmitterSettings
|
|
64
64
|
*/
|
|
65
65
|
totalParticles : 50,
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Start angle for particle launch in Radians
|
|
68
|
+
* Start angle for particle launch in Radians
|
|
69
69
|
* @public
|
|
70
|
-
* @type
|
|
70
|
+
* @type {number}
|
|
71
71
|
* @name angle
|
|
72
72
|
* @default Math.PI / 2
|
|
73
|
-
* @
|
|
73
|
+
* @memberof me.ParticleEmitterSettings
|
|
74
74
|
*/
|
|
75
75
|
angle : Math.PI / 2,
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Variation in the start angle for particle launch in Radians
|
|
78
|
+
* Variation in the start angle for particle launch in Radians
|
|
79
79
|
* @public
|
|
80
|
-
* @type
|
|
80
|
+
* @type {number}
|
|
81
81
|
* @name angleVariation
|
|
82
82
|
* @default 0
|
|
83
|
-
* @
|
|
83
|
+
* @memberof me.ParticleEmitterSettings
|
|
84
84
|
*/
|
|
85
85
|
angleVariation : 0,
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Minimum time each particle lives once it is emitted in ms
|
|
88
|
+
* Minimum time each particle lives once it is emitted in ms
|
|
89
89
|
* @public
|
|
90
|
-
* @type
|
|
90
|
+
* @type {number}
|
|
91
91
|
* @name minLife
|
|
92
92
|
* @default 1000
|
|
93
|
-
* @
|
|
93
|
+
* @memberof me.ParticleEmitterSettings
|
|
94
94
|
*/
|
|
95
95
|
minLife : 1000,
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Maximum time each particle lives once it is emitted in ms
|
|
98
|
+
* Maximum time each particle lives once it is emitted in ms
|
|
99
99
|
* @public
|
|
100
|
-
* @type
|
|
100
|
+
* @type {number}
|
|
101
101
|
* @name maxLife
|
|
102
102
|
* @default 3000
|
|
103
|
-
* @
|
|
103
|
+
* @memberof me.ParticleEmitterSettings
|
|
104
104
|
*/
|
|
105
105
|
maxLife : 3000,
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Start speed of particles.<br>
|
|
109
109
|
* @public
|
|
110
|
-
* @type
|
|
110
|
+
* @type {number}
|
|
111
111
|
* @name speed
|
|
112
112
|
* @default 2
|
|
113
|
-
* @
|
|
113
|
+
* @memberof me.ParticleEmitterSettings
|
|
114
114
|
*/
|
|
115
115
|
speed : 2,
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Variation in the start speed of particles
|
|
118
|
+
* Variation in the start speed of particles
|
|
119
119
|
* @public
|
|
120
|
-
* @type
|
|
120
|
+
* @type {number}
|
|
121
121
|
* @name speedVariation
|
|
122
122
|
* @default 1
|
|
123
|
-
* @
|
|
123
|
+
* @memberof me.ParticleEmitterSettings
|
|
124
124
|
*/
|
|
125
125
|
speedVariation : 1,
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Minimum start rotation for particles sprites in Radians
|
|
128
|
+
* Minimum start rotation for particles sprites in Radians
|
|
129
129
|
* @public
|
|
130
|
-
* @type
|
|
130
|
+
* @type {number}
|
|
131
131
|
* @name minRotation
|
|
132
132
|
* @default 0
|
|
133
|
-
* @
|
|
133
|
+
* @memberof me.ParticleEmitterSettings
|
|
134
134
|
*/
|
|
135
135
|
minRotation : 0,
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* Maximum start rotation for particles sprites in Radians
|
|
138
|
+
* Maximum start rotation for particles sprites in Radians
|
|
139
139
|
* @public
|
|
140
|
-
* @type
|
|
140
|
+
* @type {number}
|
|
141
141
|
* @name maxRotation
|
|
142
142
|
* @default 0
|
|
143
|
-
* @
|
|
143
|
+
* @memberof me.ParticleEmitterSettings
|
|
144
144
|
*/
|
|
145
145
|
maxRotation : 0,
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* Minimum start scale ratio for particles (1 = no scaling)
|
|
148
|
+
* Minimum start scale ratio for particles (1 = no scaling)
|
|
149
149
|
* @public
|
|
150
|
-
* @type
|
|
150
|
+
* @type {number}
|
|
151
151
|
* @name minStartScale
|
|
152
152
|
* @default 1
|
|
153
|
-
* @
|
|
153
|
+
* @memberof me.ParticleEmitterSettings
|
|
154
154
|
*/
|
|
155
155
|
minStartScale : 1,
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* Maximum start scale ratio for particles (1 = no scaling)
|
|
158
|
+
* Maximum start scale ratio for particles (1 = no scaling)
|
|
159
159
|
* @public
|
|
160
|
-
* @type
|
|
160
|
+
* @type {number}
|
|
161
161
|
* @name maxStartScale
|
|
162
162
|
* @default 1
|
|
163
|
-
* @
|
|
163
|
+
* @memberof me.ParticleEmitterSettings
|
|
164
164
|
*/
|
|
165
165
|
maxStartScale : 1,
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Minimum end scale ratio for particles
|
|
168
|
+
* Minimum end scale ratio for particles
|
|
169
169
|
* @public
|
|
170
|
-
* @type
|
|
170
|
+
* @type {number}
|
|
171
171
|
* @name minEndScale
|
|
172
172
|
* @default 0
|
|
173
|
-
* @
|
|
173
|
+
* @memberof me.ParticleEmitterSettings
|
|
174
174
|
*/
|
|
175
175
|
minEndScale : 0,
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
* Maximum end scale ratio for particles
|
|
178
|
+
* Maximum end scale ratio for particles
|
|
179
179
|
* @public
|
|
180
|
-
* @type
|
|
180
|
+
* @type {number}
|
|
181
181
|
* @name maxEndScale
|
|
182
182
|
* @default 0
|
|
183
|
-
* @
|
|
183
|
+
* @memberof me.ParticleEmitterSettings
|
|
184
184
|
*/
|
|
185
185
|
maxEndScale : 0,
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Vertical force (Gravity) for each particle
|
|
188
|
+
* Vertical force (Gravity) for each particle
|
|
189
189
|
* @public
|
|
190
|
-
* @type
|
|
190
|
+
* @type {number}
|
|
191
191
|
* @name gravity
|
|
192
192
|
* @default 0
|
|
193
|
-
* @
|
|
193
|
+
* @memberof me.ParticleEmitterSettings
|
|
194
194
|
* @see me.game.world.gravity
|
|
195
195
|
*/
|
|
196
196
|
gravity : 0,
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* Horizontal force (like a Wind) for each particle
|
|
199
|
+
* Horizontal force (like a Wind) for each particle
|
|
200
200
|
* @public
|
|
201
|
-
* @type
|
|
201
|
+
* @type {number}
|
|
202
202
|
* @name wind
|
|
203
203
|
* @default 0
|
|
204
|
-
* @
|
|
204
|
+
* @memberof me.ParticleEmitterSettings
|
|
205
205
|
*/
|
|
206
206
|
wind : 0,
|
|
207
207
|
|
|
@@ -210,10 +210,10 @@ var ParticleEmitterSettings = {
|
|
|
210
210
|
* The particle sprite should aim at zero angle (draw from left to right).<br>
|
|
211
211
|
* Override the particle minRotation and maxRotation.<br>
|
|
212
212
|
* @public
|
|
213
|
-
* @type
|
|
213
|
+
* @type {boolean}
|
|
214
214
|
* @name followTrajectory
|
|
215
215
|
* @default false
|
|
216
|
-
* @
|
|
216
|
+
* @memberof me.ParticleEmitterSettings
|
|
217
217
|
*/
|
|
218
218
|
followTrajectory : false,
|
|
219
219
|
|
|
@@ -221,40 +221,40 @@ var ParticleEmitterSettings = {
|
|
|
221
221
|
* Enable the Texture Additive by canvas composite operation (lighter).<br>
|
|
222
222
|
* WARNING: Composite Operation may decreases performance!.<br>
|
|
223
223
|
* @public
|
|
224
|
-
* @type
|
|
224
|
+
* @type {boolean}
|
|
225
225
|
* @name textureAdditive
|
|
226
226
|
* @default false
|
|
227
|
-
* @
|
|
227
|
+
* @memberof me.ParticleEmitterSettings
|
|
228
228
|
*/
|
|
229
229
|
textureAdditive : false,
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
232
|
* Update particles only in the viewport, remove it when out of viewport.<br>
|
|
233
233
|
* @public
|
|
234
|
-
* @type
|
|
234
|
+
* @type {boolean}
|
|
235
235
|
* @name onlyInViewport
|
|
236
236
|
* @default true
|
|
237
|
-
* @
|
|
237
|
+
* @memberof me.ParticleEmitterSettings
|
|
238
238
|
*/
|
|
239
239
|
onlyInViewport : true,
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Render particles in screen space. <br>
|
|
243
243
|
* @public
|
|
244
|
-
* @type
|
|
244
|
+
* @type {boolean}
|
|
245
245
|
* @name floating
|
|
246
246
|
* @default false
|
|
247
|
-
* @
|
|
247
|
+
* @memberof me.ParticleEmitterSettings
|
|
248
248
|
*/
|
|
249
249
|
floating : false,
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
252
|
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream).<br>
|
|
253
253
|
* @public
|
|
254
|
-
* @type
|
|
254
|
+
* @type {number}
|
|
255
255
|
* @name maxParticles
|
|
256
256
|
* @default 10
|
|
257
|
-
* @
|
|
257
|
+
* @memberof me.ParticleEmitterSettings
|
|
258
258
|
*/
|
|
259
259
|
maxParticles : 10,
|
|
260
260
|
|
|
@@ -262,10 +262,10 @@ var ParticleEmitterSettings = {
|
|
|
262
262
|
* How often a particle is emitted in ms (used only if emitter is Stream).<br>
|
|
263
263
|
* Necessary that value is greater than zero.<br>
|
|
264
264
|
* @public
|
|
265
|
-
* @type
|
|
265
|
+
* @type {number}
|
|
266
266
|
* @name frequency
|
|
267
267
|
* @default 100
|
|
268
|
-
* @
|
|
268
|
+
* @memberof me.ParticleEmitterSettings
|
|
269
269
|
*/
|
|
270
270
|
frequency : 100,
|
|
271
271
|
|
|
@@ -273,10 +273,10 @@ var ParticleEmitterSettings = {
|
|
|
273
273
|
* Duration that the emitter releases particles in ms (used only if emitter is Stream).<br>
|
|
274
274
|
* After this period, the emitter stop the launch of particles.<br>
|
|
275
275
|
* @public
|
|
276
|
-
* @type
|
|
276
|
+
* @type {number}
|
|
277
277
|
* @name duration
|
|
278
278
|
* @default Infinity
|
|
279
|
-
* @
|
|
279
|
+
* @memberof me.ParticleEmitterSettings
|
|
280
280
|
*/
|
|
281
281
|
duration : Infinity,
|
|
282
282
|
|
|
@@ -284,10 +284,10 @@ var ParticleEmitterSettings = {
|
|
|
284
284
|
* Skip n frames after updating the particle system once. <br>
|
|
285
285
|
* This can be used to reduce the performance impact of emitters with many particles.<br>
|
|
286
286
|
* @public
|
|
287
|
-
* @type
|
|
287
|
+
* @type {number}
|
|
288
288
|
* @name framesToSkip
|
|
289
289
|
* @default 0
|
|
290
|
-
* @
|
|
290
|
+
* @memberof me.ParticleEmitterSettings
|
|
291
291
|
*/
|
|
292
292
|
framesToSkip : 0
|
|
293
293
|
};
|
|
@@ -295,14 +295,12 @@ var ParticleEmitterSettings = {
|
|
|
295
295
|
/**
|
|
296
296
|
* Particle Emitter Object.
|
|
297
297
|
* @class
|
|
298
|
-
* @
|
|
299
|
-
* @
|
|
300
|
-
* @
|
|
301
|
-
* @param {
|
|
302
|
-
* @param {Number} y y-position of the particle emitter
|
|
298
|
+
* @augments Rect
|
|
299
|
+
* @memberof me
|
|
300
|
+
* @param {number} x x-position of the particle emitter
|
|
301
|
+
* @param {number} y y-position of the particle emitter
|
|
303
302
|
* @param {object} settings An object containing the settings for the particle emitter. See {@link me.ParticleEmitterSettings}
|
|
304
303
|
* @example
|
|
305
|
-
*
|
|
306
304
|
* // Create a basic emitter at position 100, 100
|
|
307
305
|
* var emitter = new me.ParticleEmitter(100, 100);
|
|
308
306
|
*
|
|
@@ -324,7 +322,6 @@ var ParticleEmitterSettings = {
|
|
|
324
322
|
* // At the end, remove emitter from the game world
|
|
325
323
|
* // call this in onDestroyEvent function
|
|
326
324
|
* me.game.world.removeChild(emitter);
|
|
327
|
-
*
|
|
328
325
|
*/
|
|
329
326
|
class ParticleEmitter extends Renderable {
|
|
330
327
|
|
|
@@ -361,45 +358,38 @@ class ParticleEmitter extends Renderable {
|
|
|
361
358
|
|
|
362
359
|
this.container = new ParticleContainer(this);
|
|
363
360
|
|
|
364
|
-
/**
|
|
365
|
-
* @ignore
|
|
366
|
-
*/
|
|
367
|
-
Object.defineProperty(this.pos, "z", {
|
|
368
|
-
/**
|
|
369
|
-
* @ignore
|
|
370
|
-
*/
|
|
371
|
-
get : (function () { return this.container.pos.z; }).bind(this),
|
|
372
|
-
/**
|
|
373
|
-
* @ignore
|
|
374
|
-
*/
|
|
375
|
-
set : (function (value) { this.container.pos.z = value; }).bind(this),
|
|
376
|
-
enumerable : true,
|
|
377
|
-
configurable : true
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Floating property for particles, value is forwarded to the particle container <br>
|
|
382
|
-
* @type Boolean
|
|
383
|
-
* @name floating
|
|
384
|
-
* @memberOf me.ParticleEmitter
|
|
385
|
-
*/
|
|
386
|
-
Object.defineProperty(this, "floating", {
|
|
387
|
-
/**
|
|
388
|
-
* @ignore
|
|
389
|
-
*/
|
|
390
|
-
get : function () { return this.container.floating; },
|
|
391
|
-
/**
|
|
392
|
-
* @ignore
|
|
393
|
-
*/
|
|
394
|
-
set : function (value) { this.container.floating = value; },
|
|
395
|
-
enumerable : true,
|
|
396
|
-
configurable : true
|
|
397
|
-
});
|
|
398
|
-
|
|
399
361
|
// Reset the emitter to defaults
|
|
400
362
|
this.reset(settings);
|
|
401
363
|
}
|
|
402
364
|
|
|
365
|
+
/**
|
|
366
|
+
* @ignore
|
|
367
|
+
*/
|
|
368
|
+
get z() {
|
|
369
|
+
return this.container.pos.z;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @ignore
|
|
374
|
+
*/
|
|
375
|
+
set z(value) {
|
|
376
|
+
this.container.pos.z = value;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Floating property for particles, value is forwarded to the particle container <br>
|
|
381
|
+
* @type {boolean}
|
|
382
|
+
* @name floating
|
|
383
|
+
* @memberof me.ParticleEmitter
|
|
384
|
+
*/
|
|
385
|
+
get floating() {
|
|
386
|
+
return this.container.floating;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
set floating(value) {
|
|
390
|
+
this.container.floating = value;
|
|
391
|
+
}
|
|
392
|
+
|
|
403
393
|
/**
|
|
404
394
|
* @ignore
|
|
405
395
|
*/
|
|
@@ -430,9 +420,9 @@ class ParticleEmitter extends Renderable {
|
|
|
430
420
|
/**
|
|
431
421
|
* returns a random point inside the bounds x axis of this emitter
|
|
432
422
|
* @name getRandomPointX
|
|
433
|
-
* @
|
|
423
|
+
* @memberof me.ParticleEmitter
|
|
434
424
|
* @function
|
|
435
|
-
* @
|
|
425
|
+
* @returns {number}
|
|
436
426
|
*/
|
|
437
427
|
getRandomPointX() {
|
|
438
428
|
return this.pos.x + randomFloat(0, this.width);
|
|
@@ -441,9 +431,9 @@ class ParticleEmitter extends Renderable {
|
|
|
441
431
|
/**
|
|
442
432
|
* returns a random point inside the bounds y axis of this emitter
|
|
443
433
|
* @name getRandomPointY
|
|
444
|
-
* @
|
|
434
|
+
* @memberof me.ParticleEmitter
|
|
445
435
|
* @function
|
|
446
|
-
* @
|
|
436
|
+
* @returns {number}
|
|
447
437
|
*/
|
|
448
438
|
getRandomPointY() {
|
|
449
439
|
return this.pos.y + randomFloat(0, this.height);
|
|
@@ -452,9 +442,9 @@ class ParticleEmitter extends Renderable {
|
|
|
452
442
|
/**
|
|
453
443
|
* Reset the emitter with default values.<br>
|
|
454
444
|
* @function
|
|
455
|
-
* @param {
|
|
445
|
+
* @param {object} settings [optional] object with emitter settings. See {@link me.ParticleEmitterSettings}
|
|
456
446
|
* @name reset
|
|
457
|
-
* @
|
|
447
|
+
* @memberof me.ParticleEmitter
|
|
458
448
|
*/
|
|
459
449
|
reset(settings) {
|
|
460
450
|
// check if settings exists and create a dummy object if necessary
|
|
@@ -484,9 +474,9 @@ class ParticleEmitter extends Renderable {
|
|
|
484
474
|
/**
|
|
485
475
|
* Emitter is of type stream and is launching particles <br>
|
|
486
476
|
* @function
|
|
487
|
-
* @returns {
|
|
477
|
+
* @returns {boolean} Emitter is Stream and is launching particles
|
|
488
478
|
* @name isRunning
|
|
489
|
-
* @
|
|
479
|
+
* @memberof me.ParticleEmitter
|
|
490
480
|
*/
|
|
491
481
|
isRunning() {
|
|
492
482
|
return this._enabled && this._stream;
|
|
@@ -495,10 +485,10 @@ class ParticleEmitter extends Renderable {
|
|
|
495
485
|
/**
|
|
496
486
|
* Launch particles from emitter constantly <br>
|
|
497
487
|
* Particles example: Fountains
|
|
498
|
-
* @param {
|
|
488
|
+
* @param {number} duration [optional] time that the emitter releases particles in ms
|
|
499
489
|
* @function
|
|
500
490
|
* @name streamParticles
|
|
501
|
-
* @
|
|
491
|
+
* @memberof me.ParticleEmitter
|
|
502
492
|
*/
|
|
503
493
|
streamParticles(duration) {
|
|
504
494
|
this._enabled = true;
|
|
@@ -511,7 +501,7 @@ class ParticleEmitter extends Renderable {
|
|
|
511
501
|
* Stop the emitter from generating new particles (used only if emitter is Stream) <br>
|
|
512
502
|
* @function
|
|
513
503
|
* @name stopStream
|
|
514
|
-
* @
|
|
504
|
+
* @memberof me.ParticleEmitter
|
|
515
505
|
*/
|
|
516
506
|
stopStream() {
|
|
517
507
|
this._enabled = false;
|
|
@@ -520,10 +510,10 @@ class ParticleEmitter extends Renderable {
|
|
|
520
510
|
/**
|
|
521
511
|
* Launch all particles from emitter and stop <br>
|
|
522
512
|
* Particles example: Explosions <br>
|
|
523
|
-
* @param {
|
|
513
|
+
* @param {number} total [optional] number of particles to launch
|
|
524
514
|
* @function
|
|
525
515
|
* @name burstParticles
|
|
526
|
-
* @
|
|
516
|
+
* @memberof me.ParticleEmitter
|
|
527
517
|
*/
|
|
528
518
|
burstParticles(total) {
|
|
529
519
|
this._enabled = true;
|
|
@@ -8,9 +8,8 @@ import Renderable from "./../renderable/renderable.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* Single Particle Object.
|
|
10
10
|
* @class Particle
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @constructor
|
|
11
|
+
* @augments me.Renderable
|
|
12
|
+
* @memberof me
|
|
14
13
|
* @param {me.ParticleEmitter} particle emitter
|
|
15
14
|
*/
|
|
16
15
|
class Particle extends Renderable {
|
|
@@ -98,10 +97,10 @@ class Particle extends Renderable {
|
|
|
98
97
|
* Update the Particle <br>
|
|
99
98
|
* This is automatically called by the game manager {@link me.game}
|
|
100
99
|
* @name update
|
|
101
|
-
* @
|
|
100
|
+
* @memberof me.Particle
|
|
102
101
|
* @function
|
|
103
102
|
* @ignore
|
|
104
|
-
* @param {
|
|
103
|
+
* @param {number} dt time since the last update in milliseconds
|
|
105
104
|
*/
|
|
106
105
|
update(dt) {
|
|
107
106
|
// move things forward independent of the current frame rate
|
|
@@ -5,9 +5,8 @@ import { viewport } from "./../game.js";
|
|
|
5
5
|
* @classdesc
|
|
6
6
|
* Particle Container Object.
|
|
7
7
|
* @class ParticleContainer
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
* @constructor
|
|
8
|
+
* @augments me.Container
|
|
9
|
+
* @memberof me
|
|
11
10
|
* @param {me.ParticleEmitter} emitter the emitter which owns this container
|
|
12
11
|
*/
|
|
13
12
|
|