littlejsengine 1.6.0 → 1.6.4

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.
Files changed (49) hide show
  1. package/README.md +133 -33
  2. package/build/littlejs.d.ts +13 -5
  3. package/build/littlejs.esm.js +106 -95
  4. package/build/littlejs.esm.min.js +1 -1
  5. package/build/littlejs.js +98 -93
  6. package/build/littlejs.min.js +1 -1
  7. package/build/littlejs.release.js +91 -91
  8. package/examples/breakout/game.js +5 -0
  9. package/examples/breakout/gameObjects.js +41 -48
  10. package/examples/breakout/index.html +3 -3
  11. package/examples/breakoutTutorial/README.md +514 -0
  12. package/examples/breakoutTutorial/game.js +181 -0
  13. package/examples/breakoutTutorial/images/1.png +0 -0
  14. package/examples/breakoutTutorial/images/10.png +0 -0
  15. package/examples/breakoutTutorial/images/11.png +0 -0
  16. package/examples/breakoutTutorial/images/2.png +0 -0
  17. package/examples/breakoutTutorial/images/3.png +0 -0
  18. package/examples/breakoutTutorial/images/4.png +0 -0
  19. package/examples/breakoutTutorial/images/5.png +0 -0
  20. package/examples/breakoutTutorial/images/6.png +0 -0
  21. package/examples/breakoutTutorial/images/7.png +0 -0
  22. package/examples/breakoutTutorial/images/8.png +0 -0
  23. package/examples/breakoutTutorial/images/9.png +0 -0
  24. package/examples/breakoutTutorial/index.html +10 -0
  25. package/examples/empty/game.js +10 -0
  26. package/examples/module/index.html +1 -1
  27. package/examples/particles/index.html +1 -1
  28. package/examples/platformer/gameLevel.js +1 -1
  29. package/examples/platformer/gamePlayer.js +1 -1
  30. package/examples/platformer/index.html +6 -6
  31. package/examples/puzzle/index.html +2 -2
  32. package/examples/starter/build.bat +3 -2
  33. package/examples/starter/game.js +9 -9
  34. package/examples/starter/index.html +13 -13
  35. package/examples/stress/index.html +1 -1
  36. package/examples/typescript/game.js +89 -89
  37. package/examples/typescript/game.ts +10 -10
  38. package/examples/typescript/index.html +1 -1
  39. package/package.json +3 -3
  40. package/src/engine.js +1 -2
  41. package/src/engineAudio.js +11 -11
  42. package/src/engineBuild.bat +3 -1
  43. package/src/engineDebug.js +8 -2
  44. package/src/engineDraw.js +19 -15
  45. package/src/engineExport.js +8 -2
  46. package/src/engineInput.js +51 -55
  47. package/src/engineObject.js +4 -4
  48. package/src/engineRelease.js +1 -0
  49. package/src/engineUtilities.js +4 -4
@@ -6,7 +6,7 @@
6
6
 
7
7
  // import module
8
8
  import * as LittleJS from '../../build/littlejs.esm.js';
9
- const {Vector2, Color, Timer, vec2} = LittleJS;
9
+ const {Color, vec2} = LittleJS;
10
10
 
11
11
  // sound effects
12
12
  const sound_click = new LittleJS.Sound([1,.5]);
@@ -16,7 +16,7 @@ const medal_example = new LittleJS.Medal(0, 'Example Medal', 'Welcome to LittleJ
16
16
  LittleJS.medalsInit('Hello World');
17
17
 
18
18
  // game variables
19
- let particleEmiter;
19
+ let particleEmitter: LittleJS.ParticleEmitter;
20
20
 
21
21
  ///////////////////////////////////////////////////////////////////////////////
22
22
  function gameInit()
@@ -55,7 +55,7 @@ function gameInit()
55
55
 
56
56
  // create particle emitter
57
57
  const center = LittleJS.tileCollisionSize.scale(.5).add(vec2(0,9));
58
- particleEmiter = new LittleJS.ParticleEmitter(
58
+ particleEmitter = new LittleJS.ParticleEmitter(
59
59
  center, 0, // emitPos, emitAngle
60
60
  1, 0, 500, Math.PI, // emitSize, emitTime, emitRate, emiteCone
61
61
  0, vec2(16), // tileIndex, tileSize
@@ -65,8 +65,8 @@ function gameInit()
65
65
  .99, 1, 1, Math.PI, // damping, angleDamping, gravityScale, cone
66
66
  .05, .5, true, true // fadeRate, randomness, collide, additive
67
67
  );
68
- particleEmiter.elasticity = .3; // bounce when it collides
69
- particleEmiter.trailScale = 2; // stretch in direction of motion
68
+ particleEmitter.elasticity = .3; // bounce when it collides
69
+ particleEmitter.trailScale = 2; // stretch in direction of motion
70
70
  }
71
71
 
72
72
  ///////////////////////////////////////////////////////////////////////////////
@@ -78,10 +78,10 @@ function gameUpdate()
78
78
  sound_click.play(LittleJS.mousePos);
79
79
 
80
80
  // change particle color and set to fade out
81
- particleEmiter.colorStartA = new Color;
82
- particleEmiter.colorStartB = LittleJS.randColor();
83
- particleEmiter.colorEndA = particleEmiter.colorStartA.scale(1,0);
84
- particleEmiter.colorEndB = particleEmiter.colorStartB.scale(1,0);
81
+ particleEmitter.colorStartA = new Color;
82
+ particleEmitter.colorStartB = LittleJS.randColor();
83
+ particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1,0);
84
+ particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1,0);
85
85
 
86
86
  // unlock medals
87
87
  medal_example.unlock();
@@ -89,7 +89,7 @@ function gameUpdate()
89
89
 
90
90
  // move particles to mouse location if on screen
91
91
  if (LittleJS.mousePosScreen.x)
92
- particleEmiter.pos = LittleJS.mousePos;
92
+ particleEmitter.pos = LittleJS.mousePos;
93
93
  }
94
94
 
95
95
  ///////////////////////////////////////////////////////////////////////////////
@@ -7,4 +7,4 @@
7
7
  </head><body>
8
8
 
9
9
  <!-- Add your game scripts here -->
10
- <script src=game.js?125 type=module></script>
10
+ <script src=game.js?126 type=module></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "littlejsengine",
3
- "version": "1.6.0",
3
+ "version": "1.6.4",
4
4
  "description": "LittleJS - Tiny and Fast HTML5 Game Engine",
5
5
  "main": "engine/engine.all.module.js",
6
6
  "repository": {
@@ -26,10 +26,10 @@
26
26
  "build": "cd src && engineBuild.bat"
27
27
  },
28
28
  "devDependencies": {
29
- "ect-bin": "~1.4.1",
30
29
  "google-closure-compiler": "~20230502.0.0",
31
30
  "roadroller": "~2.1.0",
31
+ "uglify-js": "~3.17.4",
32
32
  "typescript": "~5.1.6",
33
- "uglify-js": "~3.17.4"
33
+ "ect-bin": "~1.4.1"
34
34
  }
35
35
  }
package/src/engine.js CHANGED
@@ -34,7 +34,7 @@ const engineName = 'LittleJS';
34
34
  * @type {String}
35
35
  * @default
36
36
  * @memberof Engine */
37
- const engineVersion = '1.6.0';
37
+ const engineVersion = '1.6.4';
38
38
 
39
39
  /** Frames per second to update objects
40
40
  * @type {Number}
@@ -125,7 +125,6 @@ function engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRender
125
125
  (glCanvas||mainCanvas).style = mainCanvas.style = overlayCanvas.style = styleCanvas;
126
126
 
127
127
  gameInit();
128
- touchGamepadCreate();
129
128
  engineUpdate();
130
129
  };
131
130
 
@@ -270,7 +270,7 @@ function playSamples(sampleChannels, volume=1, rate=1, pan=0, loop=0)
270
270
  }
271
271
 
272
272
  ///////////////////////////////////////////////////////////////////////////////
273
- // ZzFXMicro - Zuper Zmall Zound Zynth - v1.1.8 by Frank Force
273
+ // ZzFXMicro - Zuper Zmall Zound Zynth - v1.2.0 by Frank Force
274
274
 
275
275
  /** Generate and play a ZzFX sound
276
276
  * <br>
@@ -296,11 +296,11 @@ function zzfxG
296
296
  bitCrush = 0, delay = 0, sustainVolume = 1, decay = 0, tremolo = 0
297
297
  )
298
298
  {
299
- // init parameters
299
+ // locals
300
300
  let PI2 = PI*2, startSlide = slide *= 500 * PI2 / zzfxR / zzfxR, b=[],
301
301
  startFrequency = frequency *= (1 + randomness*rand(-1,1)) * PI2 / zzfxR,
302
- t=0, tm=0, i=0, j=1, r=0, c=0, s=0, f, length;
303
-
302
+ t=0, tm=0, i=0, j=1, r=0, c=0, s=0, f, length
303
+
304
304
  // scale by sample rate
305
305
  attack = attack * zzfxR + 9; // minimum attack to prevent pop
306
306
  decay *= zzfxR;
@@ -350,18 +350,18 @@ function zzfxG
350
350
  Math.cos(modulation*tm++); // modulation
351
351
  t += f - f*noise*(1 - (Math.sin(i)+1)*1e9%2); // noise
352
352
 
353
- if (j && ++j > pitchJumpTime) // pitch jump
353
+ if (j && ++j > pitchJumpTime) // pitch jump
354
354
  {
355
- frequency += pitchJump; // apply pitch jump
356
- startFrequency += pitchJump; // also apply to start
357
- j = 0; // reset pitch jump time
355
+ frequency += pitchJump; // apply pitch jump
356
+ startFrequency += pitchJump; // also apply to start
357
+ j = 0; // reset pitch jump time
358
358
  }
359
359
 
360
360
  if (repeatTime && !(++r % repeatTime)) // repeat
361
361
  {
362
- frequency = startFrequency; // reset frequency
363
- slide = startSlide; // reset slide
364
- j = j || 1; // reset pitch jump time
362
+ frequency = startFrequency; // reset frequency
363
+ slide = startSlide; // reset slide
364
+ j ||= 1; // reset pitch jump time
365
365
  }
366
366
  }
367
367
 
@@ -7,7 +7,8 @@ rem --- BUILD ENGINE DEBUG ---
7
7
  set BUILD_FOLDER=build
8
8
  set ENGINE_NAME=littlejs
9
9
 
10
- cd ..
10
+ pushd ..
11
+
11
12
  rem remove old files
12
13
  rmdir /s /q %BUILD_FOLDER%
13
14
  mkdir %BUILD_FOLDER%
@@ -127,4 +128,5 @@ if %ERRORLEVEL% NEQ 0 (
127
128
  exit /b %ERRORLEVEL%
128
129
  )
129
130
 
131
+ popd
130
132
  popd
@@ -45,6 +45,12 @@ let showWatermark = 1;
45
45
  * @memberof Debug */
46
46
  let godMode = 0;
47
47
 
48
+ /** Key code used to toggle debug mode, Esc by default
49
+ * @type {Boolean}
50
+ * @default
51
+ * @memberof Debug */
52
+ let debugKey = 27;
53
+
48
54
  // Engine internal variables not exposed to documentation
49
55
  let debugPrimitives = [], debugOverlay = 0, debugPhysics = 0, debugRaycast = 0,
50
56
  debugParticles = 0, debugGamepads = 0, debugMedals = 0, debugTakeScreenshot, downloadLink;
@@ -166,7 +172,7 @@ const debugUpdate = ()=>
166
172
  if (!debug)
167
173
  return;
168
174
 
169
- if (keyWasPressed(192)) // ~
175
+ if (keyWasPressed(debugKey)) // Esc
170
176
  debugOverlay = !debugOverlay;
171
177
  if (debugOverlay)
172
178
  {
@@ -351,7 +357,7 @@ const debugRender = ()=>
351
357
  overlayContext.fillText('Time: ' + formatTime(time), x, y += h);
352
358
  overlayContext.fillText('---------', x, y += h);
353
359
  overlayContext.fillStyle = '#f00';
354
- overlayContext.fillText('~: Debug Overlay', x, y += h);
360
+ overlayContext.fillText('ESC: Debug Overlay', x, y += h);
355
361
  overlayContext.fillStyle = debugPhysics ? '#f00' : '#fff';
356
362
  overlayContext.fillText('1: Debug Physics', x, y += h);
357
363
  overlayContext.fillStyle = debugParticles ? '#f00' : '#fff';
package/src/engineDraw.js CHANGED
@@ -226,6 +226,23 @@ function setBlendMode(additive, useWebGL=glEnable)
226
226
  mainContext.globalCompositeOperation = additive ? 'lighter' : 'source-over';
227
227
  }
228
228
 
229
+ /** Draw text on overlay canvas in world space
230
+ * Automatically splits new lines into rows
231
+ * @param {String} text
232
+ * @param {Vector2} pos
233
+ * @param {Number} [size=1]
234
+ * @param {Color} [color=Color()]
235
+ * @param {Number} [lineWidth=0]
236
+ * @param {Color} [lineColor=Color(0,0,0)]
237
+ * @param {String} [textAlign='center']
238
+ * @param {String} [font=fontDefault]
239
+ * @param {CanvasRenderingContext2D} [context=overlayContext]
240
+ * @memberof Draw */
241
+ function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, context)
242
+ {
243
+ drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, context);
244
+ }
245
+
229
246
  /** Draw text on overlay canvas in screen space
230
247
  * Automatically splits new lines into rows
231
248
  * @param {String} text
@@ -235,6 +252,8 @@ function setBlendMode(additive, useWebGL=glEnable)
235
252
  * @param {Number} [lineWidth=0]
236
253
  * @param {Color} [lineColor=Color(0,0,0)]
237
254
  * @param {String} [textAlign='center']
255
+ * @param {String} [font=fontDefault]
256
+ * @param {CanvasRenderingContext2D} [context=overlayContext]
238
257
  * @memberof Draw */
239
258
  function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, context=overlayContext)
240
259
  {
@@ -255,21 +274,6 @@ function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineCol
255
274
  });
256
275
  }
257
276
 
258
- /** Draw text on overlay canvas in world space
259
- * Automatically splits new lines into rows
260
- * @param {String} text
261
- * @param {Vector2} pos
262
- * @param {Number} [size=1]
263
- * @param {Color} [color=Color()]
264
- * @param {Number} [lineWidth=0]
265
- * @param {Color} [lineColor=Color(0,0,0)]
266
- * @param {String} [textAlign='center']
267
- * @memberof Draw */
268
- function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font)
269
- {
270
- drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, mainContext);
271
- }
272
-
273
277
  ///////////////////////////////////////////////////////////////////////////////
274
278
 
275
279
  let engineFontImage;
@@ -196,6 +196,11 @@ const setShowWatermark = (show)=> showWatermark = show;
196
196
  * @memberof Debug */
197
197
  const setGodMode = (enable)=> godMode = enable;
198
198
 
199
+ /** Set key code used to toggle debug mode, Esc by default
200
+ * @param {Number} key
201
+ * @memberof Debug */
202
+ const setDebugKey = (key)=> debugKey = key;
203
+
199
204
  export {
200
205
  // Setters for global variables
201
206
  setCameraPos,
@@ -236,6 +241,7 @@ export {
236
241
  setMedalsPreventUnlock,
237
242
  setShowWatermark,
238
243
  setGodMode,
244
+ setDebugKey,
239
245
 
240
246
  // Settings
241
247
  canvasMaxSize,
@@ -322,8 +328,8 @@ export {
322
328
  Color,
323
329
  Timer,
324
330
  vec2,
325
- colorRGBA,
326
- colorHSLA,
331
+ rgb,
332
+ hsl,
327
333
 
328
334
  // Base
329
335
  EngineObject,
@@ -292,6 +292,9 @@ if (isTouchDevice)
292
292
  return true;
293
293
  }
294
294
 
295
+ // try to create touch game pad
296
+ touchGamepadEnable && touchGamepadCreate();
297
+
295
298
  return ontouchstart(e);
296
299
  }
297
300
  }
@@ -305,76 +308,69 @@ let touchGamepadTimer = new Timer, touchGamepadButtons, touchGamepadStick;
305
308
  // create the touch gamepad, called automatically by the engine
306
309
  function touchGamepadCreate()
307
310
  {
308
- if (!touchGamepadEnable || !isTouchDevice)
309
- return;
310
-
311
311
  // touch input internal variables
312
312
  touchGamepadButtons = [];
313
313
  touchGamepadStick = vec2();
314
314
 
315
- // setup touch input
316
- ontouchstart = (e)=>
315
+ let touchHandler = ontouchstart;
316
+ ontouchstart = ontouchmove = ontouchend = (e)=>
317
317
  {
318
- // fix mobile audio, force it to play a sound on first touch
319
- zzfx(0);
320
-
321
- ontouchstart = ontouchmove = ontouchend = (e)=>
318
+ // clear touch gamepad input
319
+ touchGamepadStick = vec2();
320
+ touchGamepadButtons = [];
321
+
322
+ const touching = e.touches.length;
323
+ if (touching)
322
324
  {
323
- // clear touch gamepad input
324
- touchGamepadStick = vec2();
325
- touchGamepadButtons = [];
326
-
327
- const touching = e.touches.length;
328
- if (touching)
325
+ touchGamepadTimer.set();
326
+ if (paused)
329
327
  {
330
- // set that gamepad is active
331
- isUsingGamepad = 1;
332
- touchGamepadTimer.set();
333
-
334
- if (paused)
335
- {
336
- // touch anywhere to press start when paused
337
- touchGamepadButtons[9] = 1;
338
- return;
339
- }
328
+ // touch anywhere to press start when paused
329
+ touchGamepadButtons[9] = 1;
330
+ return;
340
331
  }
332
+ }
341
333
 
342
- // get center of left and right sides
343
- const stickCenter = vec2(touchGamepadSize, mainCanvasSize.y-touchGamepadSize);
344
- const buttonCenter = mainCanvasSize.subtract(vec2(touchGamepadSize, touchGamepadSize));
345
- const startCenter = mainCanvasSize.scale(.5);
334
+ // get center of left and right sides
335
+ const stickCenter = vec2(touchGamepadSize, mainCanvasSize.y-touchGamepadSize);
336
+ const buttonCenter = mainCanvasSize.subtract(vec2(touchGamepadSize, touchGamepadSize));
337
+ const startCenter = mainCanvasSize.scale(.5);
346
338
 
347
- // check each touch point
348
- for (const touch of e.touches)
339
+ // check each touch point
340
+ for (const touch of e.touches)
341
+ {
342
+ const touchPos = mouseToScreen(vec2(touch.clientX, touch.clientY));
343
+ if (touchPos.distance(stickCenter) < touchGamepadSize)
349
344
  {
350
- const touchPos = mouseToScreen(vec2(touch.clientX, touch.clientY));
351
- if (touchPos.distance(stickCenter) < touchGamepadSize)
352
- {
353
- // virtual analog stick
354
- if (touchGamepadAnalog)
355
- touchGamepadStick = touchPos.subtract(stickCenter).scale(2/touchGamepadSize).clampLength();
356
- else
357
- {
358
- // 8 way dpad
359
- const angle = touchPos.subtract(stickCenter).angle();
360
- touchGamepadStick.setAngle((angle * 4 / PI + 8.5 | 0) * PI / 4);
361
- }
362
- }
363
- else if (touchPos.distance(buttonCenter) < touchGamepadSize)
364
- {
365
- // virtual face buttons
366
- const button = touchPos.subtract(buttonCenter).direction();
367
- touchGamepadButtons[button] = 1;
368
- }
369
- else if (touchPos.distance(startCenter) < touchGamepadSize)
345
+ // virtual analog stick
346
+ if (touchGamepadAnalog)
347
+ touchGamepadStick = touchPos.subtract(stickCenter).scale(2/touchGamepadSize).clampLength();
348
+ else
370
349
  {
371
- // virtual start button in center
372
- touchGamepadButtons[9] = 1;
350
+ // 8 way dpad
351
+ const angle = touchPos.subtract(stickCenter).angle();
352
+ touchGamepadStick.setAngle((angle * 4 / PI + 8.5 | 0) * PI / 4);
373
353
  }
374
354
  }
355
+ else if (touchPos.distance(buttonCenter) < touchGamepadSize)
356
+ {
357
+ // virtual face buttons
358
+ const button = touchPos.subtract(buttonCenter).direction();
359
+ touchGamepadButtons[button] = 1;
360
+ }
361
+ else if (touchPos.distance(startCenter) < touchGamepadSize)
362
+ {
363
+ // virtual start button in center
364
+ touchGamepadButtons[9] = 1;
365
+ }
375
366
  }
376
367
 
377
- return ontouchstart(e);
368
+ // call default touch handler and set to using gamepad
369
+ touchHandler(e);
370
+ isUsingGamepad = 1;
371
+
372
+ // must return true so the document will get focus
373
+ return true;
378
374
  }
379
375
  }
380
376
 
@@ -400,7 +396,7 @@ function touchGamepadRender()
400
396
  overlayContext.beginPath();
401
397
 
402
398
  const leftCenter = vec2(touchGamepadSize, mainCanvasSize.y-touchGamepadSize);
403
- if (touchGamepadAnalog)
399
+ if (touchGamepadAnalog) // draw circle shaped gamepad
404
400
  {
405
401
  overlayContext.arc(leftCenter.x, leftCenter.y, touchGamepadSize/2, 0, 9);
406
402
  overlayContext.fill();
@@ -112,6 +112,7 @@ class EngineObject
112
112
  this.velocity.y += gravity * this.gravityScale;
113
113
  this.pos.x += this.velocity.x *= this.damping;
114
114
  this.pos.y += this.velocity.y *= this.damping;
115
+ this.angle += this.angleVelocity *= this.angleDamping;
115
116
 
116
117
  // physics sanity checks
117
118
  ASSERT(this.angleDamping >= 0 && this.angleDamping <= 1);
@@ -168,6 +169,7 @@ class EngineObject
168
169
  const smallStepUp = (oldPos.y - o.pos.y)*2 > sizeBoth.y + gravity; // prefer to push up if small delta
169
170
  const isBlockedX = abs(oldPos.y - o.pos.y)*2 < sizeBoth.y;
170
171
  const isBlockedY = abs(oldPos.x - o.pos.x)*2 < sizeBoth.x;
172
+ const elasticity = max(this.elasticity, o.elasticity);
171
173
 
172
174
  if (smallStepUp | isBlockedY | !isBlockedX) // resolve y collision
173
175
  {
@@ -180,7 +182,7 @@ class EngineObject
180
182
  this.groundObject = o;
181
183
 
182
184
  // bounce if other object is fixed or grounded
183
- this.velocity.y *= -this.elasticity;
185
+ this.velocity.y *= -elasticity;
184
186
  }
185
187
  else if (o.mass)
186
188
  {
@@ -194,7 +196,6 @@ class EngineObject
194
196
  + this.velocity.y * 2 * this.mass / (this.mass + o.mass);
195
197
 
196
198
  // lerp betwen elastic or inelastic based on elasticity
197
- const elasticity = max(this.elasticity, o.elasticity);
198
199
  this.velocity.y = lerp(elasticity, inelastic, elastic0);
199
200
  o.velocity.y = lerp(elasticity, inelastic, elastic1);
200
201
  }
@@ -215,12 +216,11 @@ class EngineObject
215
216
  + this.velocity.x * 2 * this.mass / (this.mass + o.mass);
216
217
 
217
218
  // lerp betwen elastic or inelastic based on elasticity
218
- const elasticity = max(this.elasticity, o.elasticity);
219
219
  this.velocity.x = lerp(elasticity, inelastic, elastic0);
220
220
  o.velocity.x = lerp(elasticity, inelastic, elastic1);
221
221
  }
222
222
  else // bounce if other object is fixed
223
- this.velocity.x *= -this.elasticity;
223
+ this.velocity.x *= -elasticity;
224
224
  }
225
225
  debugOverlay && debugPhysics && debugAABB(this.pos, this.size, o.pos, o.size, '#f0f');
226
226
  }
@@ -10,6 +10,7 @@
10
10
 
11
11
  let showWatermark = 0;
12
12
  let godMode = 0;
13
+ let debugKeyCode = 0;
13
14
  const debug = 0;
14
15
  const debugOverlay = 0;
15
16
  const debugPhysics = 0;
@@ -348,7 +348,7 @@ class Vector2
348
348
  * @return {Color}
349
349
  * @memberof Utilities
350
350
  */
351
- const colorRGBA = (r, g, b, a)=> new Color(r, g, b, a);
351
+ const rgb = (r, g, b, a)=> new Color(r, g, b, a);
352
352
 
353
353
  /**
354
354
  * Create a color object with HSLA values
@@ -359,7 +359,7 @@ const colorRGBA = (r, g, b, a)=> new Color(r, g, b, a);
359
359
  * @return {Color}
360
360
  * @memberof Utilities
361
361
  */
362
- const colorHSLA = (h, s, l, a)=> new Color().setHSLA(h, s, l, a);
362
+ const hsl = (h, s, l, a)=> new Color().setHSLA(h, s, l, a);
363
363
 
364
364
  /**
365
365
  * Color object (red, green, blue, alpha) with some helpful functions
@@ -367,8 +367,8 @@ const colorHSLA = (h, s, l, a)=> new Color().setHSLA(h, s, l, a);
367
367
  * let a = new Color; // white
368
368
  * let b = new Color(1, 0, 0); // red
369
369
  * let c = new Color(0, 0, 0, 0); // transparent black
370
- * let d = colorRGBA(0, 0, 1); // blue using rgb color
371
- * let e = colorHSLA(.3, 1, .5); // green using hsl color
370
+ * let d = RGB(0, 0, 1); // blue using rgb color
371
+ * let e = HSL(.3, 1, .5); // green using hsl color
372
372
  */
373
373
  class Color
374
374
  {