littlejsengine 1.1.2 → 1.1.3
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 +55 -0
- package/build.bat +2 -1
- package/engine/engine.all.js +1320 -930
- package/engine/engine.all.min.js +1 -1
- package/engine/engine.all.release.js +965 -601
- package/engine/engine.js +71 -60
- package/engine/engineAudio.js +80 -22
- package/engine/engineBuild.bat +2 -2
- package/engine/engineDebug.js +65 -36
- package/engine/engineDraw.js +71 -56
- package/engine/engineInput.js +178 -28
- package/engine/engineMedals.js +66 -58
- package/engine/engineObject.js +86 -71
- package/engine/engineParticles.js +101 -63
- package/engine/engineRelease.js +4 -1
- package/engine/engineSettings.js +62 -53
- package/engine/engineTileLayer.js +99 -83
- package/engine/engineUtilities.js +95 -59
- package/engine/engineWebGL.js +53 -48
- package/examples/breakout/game.js +1 -1
- package/examples/breakout/gameObjects.js +2 -2
- package/examples/breakout/index.html +7 -5
- package/examples/platformer/game.js +7 -4
- package/examples/platformer/gameEffects.js +8 -11
- package/examples/platformer/gameLevel.js +15 -8
- package/examples/platformer/gameObjects.js +2 -2
- package/examples/platformer/gamePlayer.js +6 -6
- package/examples/platformer/index.html +10 -8
- package/examples/puzzle/game.js +3 -3
- package/examples/puzzle/index.html +6 -4
- package/examples/stress/index.html +7 -5
- package/game.js +10 -10
- package/index.html +17 -15
- package/package.json +4 -7
- package/tiles.png +0 -0
- package/LittleJS.zip +0 -0
- package/docs/Audio.html +0 -2264
- package/docs/Color.html +0 -2506
- package/docs/Debug.html +0 -2929
- package/docs/Draw.html +0 -3854
- package/docs/EngineObject.html +0 -2506
- package/docs/Input.html +0 -2478
- package/docs/Medal.html +0 -992
- package/docs/Medals.html +0 -624
- package/docs/Music.html +0 -569
- package/docs/Newgrounds.html +0 -1384
- package/docs/Particle.html +0 -567
- package/docs/ParticleEmitter.html +0 -1537
- package/docs/Random.html +0 -1770
- package/docs/Settings.html +0 -2885
- package/docs/Sound.html +0 -998
- package/docs/TileLayer.html +0 -3211
- package/docs/TileLayerData.html +0 -569
- package/docs/Timer.html +0 -1168
- package/docs/Utilities.html +0 -3266
- package/docs/Vector2.html +0 -3956
- package/docs/WebGL.html +0 -1842
- package/docs/engine.js.html +0 -428
- package/docs/engineAudio.js.html +0 -567
- package/docs/engineDebug.js.html +0 -721
- package/docs/engineDraw.js.html +0 -409
- package/docs/engineInput.js.html +0 -397
- package/docs/engineMedals.js.html +0 -445
- package/docs/engineObject.js.html +0 -492
- package/docs/engineParticles.js.html +0 -399
- package/docs/engineSettings.js.html +0 -358
- package/docs/engineTileLayer.js.html +0 -482
- package/docs/engineUtilities.js.html +0 -600
- package/docs/engineWebGL.js.html +0 -507
- package/docs/fonts/MavenPro-Regular.ttf +0 -0
- package/docs/fonts/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Muli-Black.ttf +0 -0
- package/docs/fonts/OFL-hind.txt +0 -93
- package/docs/fonts/OFL-montserrat.txt +0 -93
- package/docs/global.html +0 -1635
- package/docs/index.html +0 -243
- package/docs/scripts/fix-code-block.js +0 -53
- package/docs/scripts/fix-navbar.js +0 -25
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/misc.js +0 -217
- package/docs/scripts/resize.js +0 -85
- package/docs/scripts/search.js +0 -83
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -202
- package/docs/scripts/third-party/fuse.js +0 -9
- package/docs/scripts/third-party/lang-css.js +0 -2
- package/docs/scripts/third-party/prettify.js +0 -28
- package/docs/static/favicon.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -393
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -324
- package/docs/styles/clean-jsdoc-theme-light.css +0 -319
- package/docs/styles/reset.css +0 -346
- package/docs/styles/third-party/ionicons.min.css +0 -11
- package/docs/styles/third-party/prettify-jsdoc.css +0 -111
- package/docs/styles/third-party/prettify-tomorrow.css +0 -5
|
@@ -9,37 +9,50 @@
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Particle Emitter - Spawns particles with the given settings
|
|
12
|
+
* @extends EngineObject
|
|
13
|
+
* @example
|
|
14
|
+
* // create a particle emitter
|
|
15
|
+
* let pos = vec2(2,3);
|
|
16
|
+
* let particleEmiter = new ParticleEmitter
|
|
17
|
+
* (
|
|
18
|
+
* pos, 1, 0, 500, PI, // pos, emitSize, emitTime, emitRate, emiteCone
|
|
19
|
+
* 0, vec2(16), // tileIndex, tileSize
|
|
20
|
+
* new Color, new Color(0,0,0), // colorStartA, colorStartB
|
|
21
|
+
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
|
|
22
|
+
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
|
|
23
|
+
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
|
|
24
|
+
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
|
|
25
|
+
* );
|
|
12
26
|
*/
|
|
13
27
|
class ParticleEmitter extends EngineObject
|
|
14
28
|
{
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param {Number} [renderOrder=0] - Render order for particles (additive is above other stuff by default)
|
|
29
|
+
/** Create a particle system with the given settings
|
|
30
|
+
* @param {Vector2} position - World space position of the emitter
|
|
31
|
+
* @param {Number} [emitSize=0] - World space size of the emitter (float for circle diameter, vec2 for rect)
|
|
32
|
+
* @param {Number} [emitTime=0] - How long to stay alive (0 is forever)
|
|
33
|
+
* @param {Number} [emitRate=100] - How many particles per second to spawn, does not emit if 0
|
|
34
|
+
* @param {Number} [emitConeAngle=PI] - Local angle to apply velocity to particles from emitter
|
|
35
|
+
* @param {Number} [tileIndex=-1] - Index into tile sheet, if <0 no texture is applied
|
|
36
|
+
* @param {Number} [tileSize=tileSizeDefault] - Tile size for particles
|
|
37
|
+
* @param {Color} [colorStartA=new Color(1,1,1)] - Color at start of life 1, randomized between start colors
|
|
38
|
+
* @param {Color} [colorStartB=new Color(1,1,1)] - Color at start of life 2, randomized between start colors
|
|
39
|
+
* @param {Color} [colorEndA=new Color(1,1,1,0)] - Color at end of life 1, randomized between end colors
|
|
40
|
+
* @param {Color} [colorEndB=new Color(1,1,1,0)] - Color at end of life 2, randomized between end colors
|
|
41
|
+
* @param {Number} [particleTime=.5] - How long particles live
|
|
42
|
+
* @param {Number} [sizeStart=.1] - How big are particles at start
|
|
43
|
+
* @param {Number} [sizeEnd=1] - How big are particles at end
|
|
44
|
+
* @param {Number} [speed=.1] - How fast are particles when spawned
|
|
45
|
+
* @param {Number} [angleSpeed=.05] - How fast are particles rotating
|
|
46
|
+
* @param {Number} [damping=1] - How much to dampen particle speed
|
|
47
|
+
* @param {Number} [angleDamping=1] - How much to dampen particle angular speed
|
|
48
|
+
* @param {Number} [gravityScale=0] - How much does gravity effect particles
|
|
49
|
+
* @param {Number} [particleConeAngle=PI] - Cone for start particle angle
|
|
50
|
+
* @param {Number} [fadeRate=.1] - How quick to fade in particles at start/end in percent of life
|
|
51
|
+
* @param {Number} [randomness=.2] - Apply extra randomness percent
|
|
52
|
+
* @param {Boolean} [collideTiles=0] - Do particles collide against tiles
|
|
53
|
+
* @param {Boolean} [additive=0] - Should particles use addtive blend
|
|
54
|
+
* @param {Boolean} [randomColorLinear=1] - Should color be randomized linearly or across each component
|
|
55
|
+
* @param {Number} [renderOrder=0] - Render order for particles (additive is above other stuff by default)
|
|
43
56
|
*/
|
|
44
57
|
constructor
|
|
45
58
|
(
|
|
@@ -49,7 +62,7 @@ class ParticleEmitter extends EngineObject
|
|
|
49
62
|
emitRate = 100,
|
|
50
63
|
emitConeAngle = PI,
|
|
51
64
|
tileIndex = -1,
|
|
52
|
-
tileSize =
|
|
65
|
+
tileSize = tileSizeDefault,
|
|
53
66
|
colorStartA = new Color,
|
|
54
67
|
colorStartB = new Color,
|
|
55
68
|
colorEndA = new Color(1,1,1,0),
|
|
@@ -71,37 +84,61 @@ class ParticleEmitter extends EngineObject
|
|
|
71
84
|
renderOrder = additive ? 1e9 : 0
|
|
72
85
|
)
|
|
73
86
|
{
|
|
74
|
-
super(pos, new Vector2, tileIndex, tileSize);
|
|
87
|
+
super(pos, new Vector2, tileIndex, tileSize, 0, undefined, renderOrder);
|
|
75
88
|
|
|
76
89
|
// emitter settings
|
|
90
|
+
/** @property {Number} - World space size of the emitter (float for circle diameter, vec2 for rect) */
|
|
77
91
|
this.emitSize = emitSize
|
|
92
|
+
/** @property {Number} - How long to stay alive (0 is forever) */
|
|
78
93
|
this.emitTime = emitTime;
|
|
94
|
+
/** @property {Number} - How many particles per second to spawn, does not emit if 0 */
|
|
79
95
|
this.emitRate = emitRate;
|
|
96
|
+
/** @property {Number} - Local angle to apply velocity to particles from emitter */
|
|
80
97
|
this.emitConeAngle = emitConeAngle;
|
|
81
98
|
|
|
82
99
|
// color settings
|
|
100
|
+
/** @property {Color} - Color at start of life 1, randomized between start colors */
|
|
83
101
|
this.colorStartA = colorStartA;
|
|
102
|
+
/** @property {Color} - Color at start of life 2, randomized between start colors */
|
|
84
103
|
this.colorStartB = colorStartB;
|
|
104
|
+
/** @property {Color} - Color at end of life 1, randomized between end colors */
|
|
85
105
|
this.colorEndA = colorEndA;
|
|
106
|
+
/** @property {Color} - Color at end of life 2, randomized between end colors */
|
|
86
107
|
this.colorEndB = colorEndB;
|
|
108
|
+
/** @property {Boolean} - Should color be randomized linearly or across each component */
|
|
87
109
|
this.randomColorLinear = randomColorLinear;
|
|
88
110
|
|
|
89
111
|
// particle settings
|
|
112
|
+
/** @property {Number} - How long particles live */
|
|
90
113
|
this.particleTime = particleTime;
|
|
114
|
+
/** @property {Number} - How big are particles at start */
|
|
91
115
|
this.sizeStart = sizeStart;
|
|
116
|
+
/** @property {Number} - How big are particles at end */
|
|
92
117
|
this.sizeEnd = sizeEnd;
|
|
118
|
+
/** @property {Number} - How fast are particles when spawned */
|
|
93
119
|
this.speed = speed;
|
|
120
|
+
/** @property {Number} - How fast are particles rotating */
|
|
94
121
|
this.angleSpeed = angleSpeed;
|
|
122
|
+
/** @property {Number} - How much to dampen particle speed */
|
|
95
123
|
this.damping = damping;
|
|
124
|
+
/** @property {Number} - How much to dampen particle angular speed */
|
|
96
125
|
this.angleDamping = angleDamping;
|
|
126
|
+
/** @property {Number} - How much does gravity effect particles */
|
|
97
127
|
this.gravityScale = gravityScale;
|
|
128
|
+
/** @property {Number} - Cone for start particle angle */
|
|
98
129
|
this.particleConeAngle = particleConeAngle;
|
|
130
|
+
/** @property {Number} - How quick to fade in particles at start/end in percent of life */
|
|
99
131
|
this.fadeRate = fadeRate;
|
|
132
|
+
/** @property {Number} - Apply extra randomness percent */
|
|
100
133
|
this.randomness = randomness;
|
|
134
|
+
/** @property {Number} - Do particles collide against tiles */
|
|
101
135
|
this.collideTiles = collideTiles;
|
|
136
|
+
/** @property {Number} - Should particles use addtive blend */
|
|
102
137
|
this.additive = additive;
|
|
103
|
-
|
|
104
|
-
this.trailScale =
|
|
138
|
+
/** @property {Number} - If set the partile is drawn as a trail, stretched in the drection of velocity */
|
|
139
|
+
this.trailScale = 0;
|
|
140
|
+
|
|
141
|
+
// internal variables
|
|
105
142
|
this.emitTimeBuffer = 0;
|
|
106
143
|
}
|
|
107
144
|
|
|
@@ -115,9 +152,9 @@ class ParticleEmitter extends EngineObject
|
|
|
115
152
|
if (!this.emitTime || this.getAliveTime() <= this.emitTime)
|
|
116
153
|
{
|
|
117
154
|
// emit particles
|
|
118
|
-
if (this.emitRate)
|
|
155
|
+
if (this.emitRate * particleEmitRateScale)
|
|
119
156
|
{
|
|
120
|
-
const rate = 1/this.emitRate;
|
|
157
|
+
const rate = 1/this.emitRate/particleEmitRateScale;
|
|
121
158
|
for (this.emitTimeBuffer += timeDelta; this.emitTimeBuffer > 0; this.emitTimeBuffer -= rate)
|
|
122
159
|
this.emitParticle();
|
|
123
160
|
}
|
|
@@ -144,34 +181,34 @@ class ParticleEmitter extends EngineObject
|
|
|
144
181
|
const randomizeScale = (v)=> v + v*rand(randomness, -randomness);
|
|
145
182
|
|
|
146
183
|
// randomize particle settings
|
|
147
|
-
const particleTime
|
|
148
|
-
const sizeStart
|
|
149
|
-
const sizeEnd
|
|
150
|
-
const speed
|
|
151
|
-
const angleSpeed
|
|
152
|
-
const coneAngle
|
|
153
|
-
const colorStart
|
|
154
|
-
const colorEnd
|
|
184
|
+
const particleTime = randomizeScale(this.particleTime);
|
|
185
|
+
const sizeStart = randomizeScale(this.sizeStart);
|
|
186
|
+
const sizeEnd = randomizeScale(this.sizeEnd);
|
|
187
|
+
const speed = randomizeScale(this.speed);
|
|
188
|
+
const angleSpeed = randomizeScale(this.angleSpeed) * randSign();
|
|
189
|
+
const coneAngle = rand(this.emitConeAngle, -this.emitConeAngle);
|
|
190
|
+
const colorStart = randColor(this.colorStartA, this.colorStartB, this.randomColorLinear);
|
|
191
|
+
const colorEnd = randColor(this.colorEndA, this.colorEndB, this.randomColorLinear);
|
|
155
192
|
|
|
156
193
|
// build particle settings
|
|
157
|
-
particle.colorStart
|
|
158
|
-
particle.colorEndDelta
|
|
159
|
-
particle.velocity
|
|
160
|
-
particle.angleVelocity
|
|
161
|
-
particle.lifeTime
|
|
162
|
-
particle.sizeStart
|
|
163
|
-
particle.sizeEndDelta
|
|
164
|
-
particle.fadeRate
|
|
165
|
-
particle.damping
|
|
166
|
-
particle.angleDamping
|
|
167
|
-
particle.elasticity
|
|
168
|
-
particle.friction
|
|
169
|
-
particle.gravityScale
|
|
170
|
-
particle.collideTiles
|
|
171
|
-
particle.additive
|
|
172
|
-
particle.renderOrder
|
|
173
|
-
particle.trailScale
|
|
174
|
-
particle.mirror
|
|
194
|
+
particle.colorStart = colorStart;
|
|
195
|
+
particle.colorEndDelta = colorEnd.subtract(colorStart);
|
|
196
|
+
particle.velocity = (new Vector2).setAngle(this.angle + coneAngle, speed);
|
|
197
|
+
particle.angleVelocity = angleSpeed;
|
|
198
|
+
particle.lifeTime = particleTime;
|
|
199
|
+
particle.sizeStart = sizeStart;
|
|
200
|
+
particle.sizeEndDelta = sizeEnd - sizeStart;
|
|
201
|
+
particle.fadeRate = this.fadeRate;
|
|
202
|
+
particle.damping = this.damping;
|
|
203
|
+
particle.angleDamping = this.angleDamping;
|
|
204
|
+
particle.elasticity = this.elasticity;
|
|
205
|
+
particle.friction = this.friction;
|
|
206
|
+
particle.gravityScale = this.gravityScale;
|
|
207
|
+
particle.collideTiles = this.collideTiles;
|
|
208
|
+
particle.additive = this.additive;
|
|
209
|
+
particle.renderOrder = this.renderOrder;
|
|
210
|
+
particle.trailScale = this.trailScale;
|
|
211
|
+
particle.mirror = rand()<.5;
|
|
175
212
|
|
|
176
213
|
// setup callbacks for particles
|
|
177
214
|
particle.destroyCallback = this.particleDestroyCallback;
|
|
@@ -188,15 +225,16 @@ class ParticleEmitter extends EngineObject
|
|
|
188
225
|
///////////////////////////////////////////////////////////////////////////////
|
|
189
226
|
/**
|
|
190
227
|
* Particle Object - Created automatically by Particle Emitters
|
|
228
|
+
* @extends EngineObject
|
|
191
229
|
*/
|
|
192
230
|
class Particle extends EngineObject
|
|
193
231
|
{
|
|
194
232
|
/**
|
|
195
233
|
* Create a particle with the given settings
|
|
196
234
|
* @param {Vector2} position - World space position of the particle
|
|
197
|
-
* @param {Number} [tileIndex=-1]
|
|
198
|
-
* @param {Vector2} [tileSize=
|
|
199
|
-
* @param {Number} [angle=0]
|
|
235
|
+
* @param {Number} [tileIndex=-1] - Tile to use to render, untextured if -1
|
|
236
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Size of tile in source pixels
|
|
237
|
+
* @param {Number} [angle=0] - Angle to rotate the particle
|
|
200
238
|
*/
|
|
201
239
|
constructor(pos, tileIndex, tileSize, angle) { super(pos, new Vector2, tileIndex, tileSize, angle); }
|
|
202
240
|
|
package/engine/engineRelease.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
LittleJS - Release
|
|
2
|
+
LittleJS - Release Build
|
|
3
|
+
MIT License - Copyright 2021 Frank Force
|
|
4
|
+
|
|
3
5
|
- This file is used for release builds in place of engineDebug.js
|
|
4
6
|
- Debug functionality will be disabled to lower size and increase performance
|
|
5
7
|
*/
|
|
@@ -26,5 +28,6 @@ const debugCircle = ()=> {}
|
|
|
26
28
|
const debugPoint = ()=> {}
|
|
27
29
|
const debugLine = ()=> {}
|
|
28
30
|
const debugAABB = ()=> {}
|
|
31
|
+
const debugText = ()=> {}
|
|
29
32
|
const debugClear = ()=> {}
|
|
30
33
|
const debugSaveCanvas = ()=> {}
|
package/engine/engineSettings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* LittleJS Engine Settings
|
|
3
|
+
* @namespace Settings
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -8,35 +8,27 @@
|
|
|
8
8
|
///////////////////////////////////////////////////////////////////////////////
|
|
9
9
|
// Display settings
|
|
10
10
|
|
|
11
|
-
/** The max
|
|
12
|
-
* @
|
|
13
|
-
* @memberof Settings */
|
|
14
|
-
const maxWidth = 1920;
|
|
15
|
-
|
|
16
|
-
/** The max height of the canvas, centered if window is larger
|
|
17
|
-
* @default
|
|
18
|
-
* @memberof Settings */
|
|
19
|
-
const maxHeight = 1200; // up to 1080p and 16:10
|
|
20
|
-
|
|
21
|
-
/** Fixed witdh, if enabled cavnvas size never changes
|
|
11
|
+
/** The max size of the canvas, centered if window is larger
|
|
12
|
+
* @type {Vector2}
|
|
22
13
|
* @default
|
|
23
14
|
* @memberof Settings */
|
|
24
|
-
let
|
|
15
|
+
let canvasMaxSize = vec2(1920, 1200);
|
|
25
16
|
|
|
26
|
-
/** Fixed
|
|
17
|
+
/** Fixed size of the canvas, if enabled cavnvas size never changes
|
|
18
|
+
* @type {Vector2}
|
|
27
19
|
* @default
|
|
28
20
|
* @memberof Settings */
|
|
29
|
-
let
|
|
21
|
+
let canvasFixedSize = vec2();
|
|
30
22
|
|
|
31
|
-
/**
|
|
23
|
+
/** Disables anti aliasing for pixel art if true
|
|
32
24
|
* @default
|
|
33
25
|
* @memberof Settings */
|
|
34
|
-
let
|
|
26
|
+
let cavasPixelated = 1;
|
|
35
27
|
|
|
36
28
|
/** Default font used for text rendering
|
|
37
29
|
* @default
|
|
38
30
|
* @memberof Settings */
|
|
39
|
-
let
|
|
31
|
+
let fontDefault = 'arial';
|
|
40
32
|
|
|
41
33
|
///////////////////////////////////////////////////////////////////////////////
|
|
42
34
|
// Tile sheet settings
|
|
@@ -45,17 +37,12 @@ let defaultFont = 'arial';
|
|
|
45
37
|
* @type {Vector2}
|
|
46
38
|
* @default
|
|
47
39
|
* @memberof Settings */
|
|
48
|
-
|
|
40
|
+
let tileSizeDefault = vec2(16);
|
|
49
41
|
|
|
50
42
|
/** Prevent tile bleeding from neighbors in pixels
|
|
51
43
|
* @default
|
|
52
44
|
* @memberof Settings */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** Use crisp pixels for pixel art if true
|
|
56
|
-
* @default
|
|
57
|
-
* @memberof Settings */
|
|
58
|
-
let pixelated = 1;
|
|
45
|
+
let tileFixBleedScale = .3;
|
|
59
46
|
|
|
60
47
|
///////////////////////////////////////////////////////////////////////////////
|
|
61
48
|
// Object settings
|
|
@@ -64,43 +51,48 @@ let pixelated = 1;
|
|
|
64
51
|
* @type {Vector2}
|
|
65
52
|
* @default
|
|
66
53
|
* @memberof Settings */
|
|
67
|
-
|
|
54
|
+
let objectDefaultSize = vec2(1);
|
|
68
55
|
|
|
69
56
|
/** Default object mass for collison calcuations (how heavy objects are)
|
|
70
57
|
* @default
|
|
71
58
|
* @memberof Settings */
|
|
72
|
-
|
|
59
|
+
let objectDefaultMass = 1;
|
|
73
60
|
|
|
74
61
|
/** How much to slow velocity by each frame (0-1)
|
|
75
62
|
* @default
|
|
76
63
|
* @memberof Settings */
|
|
77
|
-
|
|
64
|
+
let objectDefaultDamping = .99;
|
|
78
65
|
|
|
79
66
|
/** How much to slow angular velocity each frame (0-1)
|
|
80
67
|
* @default
|
|
81
68
|
* @memberof Settings */
|
|
82
|
-
|
|
69
|
+
let objectDefaultAngleDamping = .99;
|
|
83
70
|
|
|
84
71
|
/** How much to bounce when a collision occurs (0-1)
|
|
85
72
|
* @default
|
|
86
73
|
* @memberof Settings */
|
|
87
|
-
|
|
74
|
+
let objectDefaultElasticity = 0;
|
|
88
75
|
|
|
89
76
|
/** How much to slow when touching (0-1)
|
|
90
77
|
* @default
|
|
91
78
|
* @memberof Settings */
|
|
92
|
-
|
|
79
|
+
let objectDefaultFriction = .8;
|
|
93
80
|
|
|
94
81
|
/** Clamp max speed to avoid fast objects missing collisions
|
|
95
82
|
* @default
|
|
96
83
|
* @memberof Settings */
|
|
97
|
-
|
|
84
|
+
let objectMaxSpeed = 1;
|
|
98
85
|
|
|
99
86
|
/** How much gravity to apply to objects along the Y axis, negative is down
|
|
100
87
|
* @default
|
|
101
88
|
* @memberof Settings */
|
|
102
89
|
let gravity = 0;
|
|
103
90
|
|
|
91
|
+
/** Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
|
|
92
|
+
* @default
|
|
93
|
+
* @memberof Settings */
|
|
94
|
+
let particleEmitRateScale = 1;
|
|
95
|
+
|
|
104
96
|
///////////////////////////////////////////////////////////////////////////////
|
|
105
97
|
// Camera settings
|
|
106
98
|
|
|
@@ -113,7 +105,7 @@ let cameraPos = vec2();
|
|
|
113
105
|
/** Scale of camera in world space
|
|
114
106
|
* @default
|
|
115
107
|
* @memberof Settings */
|
|
116
|
-
let cameraScale = max(
|
|
108
|
+
let cameraScale = max(tileSizeDefault.x, tileSizeDefault.y);
|
|
117
109
|
|
|
118
110
|
///////////////////////////////////////////////////////////////////////////////
|
|
119
111
|
// WebGL settings
|
|
@@ -121,7 +113,7 @@ let cameraScale = max(defaultTileSize.x, defaultTileSize.y);
|
|
|
121
113
|
/** Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)
|
|
122
114
|
* @default
|
|
123
115
|
* @memberof Settings */
|
|
124
|
-
|
|
116
|
+
let glEnable = 1;
|
|
125
117
|
|
|
126
118
|
/** Fixes slow rendering in some browsers by not compositing the WebGL canvas
|
|
127
119
|
* @default
|
|
@@ -134,45 +126,62 @@ let glOverlay = 1;
|
|
|
134
126
|
/** Should gamepads be allowed
|
|
135
127
|
* @default
|
|
136
128
|
* @memberof Settings */
|
|
137
|
-
|
|
129
|
+
let gamepadsEnable = 1;
|
|
138
130
|
|
|
139
|
-
/** If true
|
|
131
|
+
/** If true, the dpad input is also routed to the left analog stick (for better accessability)
|
|
140
132
|
* @default
|
|
141
133
|
* @memberof Settings */
|
|
142
|
-
|
|
134
|
+
let gamepadDirectionEmulateStick = 1;
|
|
143
135
|
|
|
144
|
-
/**
|
|
136
|
+
/** If true the WASD keys are also routed to the direction keys (for better accessability)
|
|
145
137
|
* @default
|
|
146
138
|
* @memberof Settings */
|
|
147
|
-
|
|
139
|
+
let inputWASDEmulateDirection = 1;
|
|
148
140
|
|
|
149
|
-
/**
|
|
141
|
+
/** True if touch gamepad should appear on mobile devices
|
|
142
|
+
* <br> - Supports left analog stick, 4 face buttons and start button (button 9)
|
|
143
|
+
* <br> - Must be set by end of gameInit to be activated
|
|
150
144
|
* @default
|
|
151
145
|
* @memberof Settings */
|
|
152
|
-
|
|
146
|
+
let touchGamepadEnable = 0;
|
|
147
|
+
|
|
148
|
+
/** Size of virutal gamepad for touch devices in pixels
|
|
149
|
+
* @default
|
|
150
|
+
* @memberof Settings */
|
|
151
|
+
let touchGamepadSize = 80;
|
|
152
|
+
|
|
153
|
+
/** Transparency of touch gamepad overlay
|
|
154
|
+
* @default
|
|
155
|
+
* @memberof Settings */
|
|
156
|
+
let touchGamepadAlpha = .3;
|
|
157
|
+
|
|
158
|
+
/** Allow vibration hardware if it exists
|
|
159
|
+
* @default
|
|
160
|
+
* @memberof Settings */
|
|
161
|
+
let vibrateEnable = 1;
|
|
153
162
|
|
|
154
163
|
///////////////////////////////////////////////////////////////////////////////
|
|
155
164
|
// Audio settings
|
|
156
165
|
|
|
157
|
-
/**
|
|
166
|
+
/** Volume scale to apply to all sound, music and speech
|
|
158
167
|
* @default
|
|
159
168
|
* @memberof Settings */
|
|
160
|
-
|
|
169
|
+
let soundVolume = .5;
|
|
161
170
|
|
|
162
|
-
/**
|
|
171
|
+
/** All audio code can be disabled and removed from build
|
|
163
172
|
* @default
|
|
164
173
|
* @memberof Settings */
|
|
165
|
-
let
|
|
174
|
+
let soundEnable = 1;
|
|
166
175
|
|
|
167
176
|
/** Default range where sound no longer plays
|
|
168
177
|
* @default
|
|
169
178
|
* @memberof Settings */
|
|
170
|
-
|
|
179
|
+
let soundDefaultRange = 30;
|
|
171
180
|
|
|
172
181
|
/** Default range percent to start tapering off sound (0-1)
|
|
173
182
|
* @default
|
|
174
183
|
* @memberof Settings */
|
|
175
|
-
|
|
184
|
+
let soundDefaultTaper = .7;
|
|
176
185
|
|
|
177
186
|
///////////////////////////////////////////////////////////////////////////////
|
|
178
187
|
// Medals settings
|
|
@@ -180,24 +189,24 @@ const defaultSoundTaper = .7;
|
|
|
180
189
|
/** How long to show medals for in seconds
|
|
181
190
|
* @default
|
|
182
191
|
* @memberof Settings */
|
|
183
|
-
|
|
192
|
+
let medalDisplayTime = 5;
|
|
184
193
|
|
|
185
194
|
/** How quickly to slide on/off medals in seconds
|
|
186
195
|
* @default
|
|
187
196
|
* @memberof Settings */
|
|
188
|
-
|
|
197
|
+
let medalDisplaySlideTime = .5;
|
|
189
198
|
|
|
190
199
|
/** Width of medal display
|
|
191
200
|
* @default
|
|
192
201
|
* @memberof Settings */
|
|
193
|
-
|
|
202
|
+
let medalDisplayWidth = 640;
|
|
194
203
|
|
|
195
204
|
/** Height of medal display
|
|
196
205
|
* @default
|
|
197
206
|
* @memberof Settings */
|
|
198
|
-
|
|
207
|
+
let medalDisplayHeight = 80;
|
|
199
208
|
|
|
200
209
|
/** Size of icon in medal display
|
|
201
210
|
* @default
|
|
202
211
|
* @memberof Settings */
|
|
203
|
-
|
|
212
|
+
let medalDisplayIconSize = 50;
|