littlejsengine 1.6.6 → 1.6.92

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 (57) hide show
  1. package/README.md +51 -35
  2. package/build/littlejs.d.ts +71 -80
  3. package/build/littlejs.esm.js +162 -139
  4. package/build/littlejs.esm.min.js +1 -1
  5. package/build/littlejs.js +159 -129
  6. package/build/littlejs.min.js +1 -1
  7. package/build/littlejs.release.js +1942 -1907
  8. package/examples/breakout/game.js +5 -1
  9. package/examples/breakout/index.html +5 -5
  10. package/examples/breakoutTutorial/README.md +6 -6
  11. package/examples/breakoutTutorial/game.js +3 -0
  12. package/examples/breakoutTutorial/index.html +3 -3
  13. package/examples/electron/build.js +105 -0
  14. package/examples/electron/game.js +4 -2
  15. package/examples/electron/index.html +13 -2
  16. package/examples/electron/package.json +5 -3
  17. package/examples/empty/game.js +3 -1
  18. package/examples/empty/index.html +1 -1
  19. package/examples/js13k/build.bat +2 -0
  20. package/examples/js13k/build.js +110 -0
  21. package/examples/js13k/game.js +109 -0
  22. package/examples/js13k/index.html +18 -0
  23. package/examples/js13k/tiles.png +0 -0
  24. package/examples/module/game.js +9 -3
  25. package/examples/module/index.html +2 -2
  26. package/examples/particles/index.html +7 -13
  27. package/examples/platformer/game.js +5 -2
  28. package/examples/platformer/gameEffects.js +1 -2
  29. package/examples/platformer/gamePlayer.js +2 -2
  30. package/examples/platformer/index.html +8 -8
  31. package/examples/puzzle/game.js +5 -3
  32. package/examples/puzzle/index.html +4 -4
  33. package/examples/starter/build.bat +2 -78
  34. package/examples/starter/build.js +109 -0
  35. package/examples/starter/game.js +4 -1
  36. package/examples/starter/index.html +15 -18
  37. package/examples/stress/index.html +2 -4
  38. package/examples/typescript/build.bat +2 -14
  39. package/examples/typescript/build.js +31 -0
  40. package/examples/typescript/game.js +94 -89
  41. package/examples/typescript/game.ts +9 -3
  42. package/examples/typescript/index.html +2 -2
  43. package/package.json +2 -2
  44. package/src/engine.js +3 -3
  45. package/src/engineAudio.js +2 -2
  46. package/src/engineBuild.bat +2 -132
  47. package/src/engineBuild.js +143 -0
  48. package/src/engineDebug.js +4 -10
  49. package/src/engineDraw.js +12 -4
  50. package/src/engineExport.js +1 -8
  51. package/src/engineInput.js +1 -1
  52. package/src/engineObject.js +13 -11
  53. package/src/engineParticles.js +6 -6
  54. package/src/engineRelease.js +0 -1
  55. package/src/engineTileLayer.js +31 -18
  56. package/src/engineUtilities.js +74 -61
  57. package/examples/electron/build.bat +0 -52
package/README.md CHANGED
@@ -1,7 +1,12 @@
1
1
  # ![LittleJS Logo](examples/favicon.png) LittleJS - The Tiny JavaScript Game Engine That Can
2
2
 
3
- ## All aboard!
3
+ [![NPM Package][npm]][npm-url]
4
+ [![Build Size][build-size]][build-size-url]
5
+ [![NPM Downloads][npm-downloads]][npmtrends-url]
6
+ [![DeepScan][deepscan]][deepscan-url]
7
+ [![Discord][discord]][discord-url]
4
8
 
9
+ ## All aboard!
5
10
 
6
11
  LittleJS is a super lightweight JavaScript game engine designed for modern web development. With its fast hybrid rendering system, it offers a comprehensive suite of game development tools from rendering to sound effects. The code is very clean and well documented with a variety of examples to get you started. Choo-Choo! 🚂
7
12
  <div align="center">
@@ -26,7 +31,7 @@ LittleJS is a small but powerful game engine with many features and no depenenci
26
31
 
27
32
  ### Graphics
28
33
 
29
- - Fast sprite and tile map rendering engine with WebGL
34
+ - Super fast sprite and tile map rendering engine with WebGL
30
35
  - Update and render 10,000+ objects at 60fps, often many times more
31
36
  - Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post processinge effects
32
37
 
@@ -42,21 +47,21 @@ LittleJS is a small but powerful game engine with many features and no depenenci
42
47
 
43
48
  ### Physics
44
49
 
45
- - Kinematic physics object update
46
50
  - 2D physics engine with collision handling for axis aligned boxes
47
- - Very fast collision handling for tile maps
51
+ - Very fast collision handling and raycasting for tile maps
48
52
 
49
53
  ### Flexability
50
54
 
51
55
  - Designed to work with all modern web bowsers and mobile devices
52
56
  - Compatible with TypeScript and includes [an example TS project](https://killedbyapixel.github.io/LittleJS/examples/typescript)
53
- - For size coding competitions like [js13kGames](https://js13kgames.com/), starter project builds to a 7KB zip file
54
- - Build to a Windows executable with [Electron](https://www.electronjs.org/) for distribution on platforms like Steam
57
+ - For size coding competitions like [js13kGames](https://js13kgames.com/), [a special example project builds to a 7KB zip file](https://killedbyapixel.github.io/LittleJS/examples/js13k)
58
+ - Builds to a Windows executable with [Electron](https://www.electronjs.org/) for distribution on platforms like Steam
55
59
  - Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want
56
60
 
57
- ### Extra Systems
61
+ ### And more...
58
62
 
59
- - Debug rendering system
63
+ - Node.js build system
64
+ - Debug primitives rendering system
60
65
  - Particle effects system and design tool
61
66
  - Bitmap font rendering and includes a built in engine font
62
67
  - Medal system tracks and displays achievements with Newgrounds integration
@@ -65,13 +70,11 @@ LittleJS is a small but powerful game engine with many features and no depenenci
65
70
 
66
71
  To use LittleJS download the latest package from GitHub or call ```npm install littlejsengine```. This package contains the engine and several small examples.
67
72
 
68
- [You can use the empty example template as a starting point.](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/empty/game.js) This file contians just the minimal setup to start the engine. You can also download and include [littlejs.js](https://github.com/KilledByAPixel/LittleJS/blob/main/build/littlejs.js) or [littlejs.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/build/littlejs.min.js).
69
-
70
- If your game loads any files like images you will need to run a local web server. I recommend an editor that does this automatically like [Visual Studio Code](https://code.visualstudio.com/) with the [Live Server plugin](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer). You can also use [http-server](https://www.npmjs.com/package/http-server) via npm.
73
+ [You can use the empty example template as a starting point.](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/empty/game.js) This file contains just the minimal setup to start the engine. You can also download and include [littlejs.js](https://github.com/KilledByAPixel/LittleJS/blob/main/build/littlejs.js) or [littlejs.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/build/littlejs.min.js).
71
74
 
72
- ## Tutorial
75
+ If your game loads any files like images you will need to run a local web server. Some editors can do this automatically like [Visual Studio Code](https://code.visualstudio.com/) with the [Live Server plugin](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer). You can also use [http-server](https://www.npmjs.com/package/http-server) via npm.
73
76
 
74
- - [Breakout Tutorial](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/breakoutTutorial) - Shows how to make a simple game from scatch with LittleJS.
77
+ [The Breakout Tutorial](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/breakoutTutorial) is provided to demonstrate how to make a simple game from scratch. [The tutorial is also available on YouTube.](https://youtu.be/tSwDx-NWTXE?si=bkjMa8-7AN2Wg5MO)
75
78
 
76
79
  ## Builds
77
80
 
@@ -88,7 +91,29 @@ LittleJS can also be imported as a module. There are two module flavors that are
88
91
 
89
92
  To rebuild the engine you must first run ```npm install``` to setup the necessary npm dependencies. Then call ```npm run build``` to build the engine.
90
93
 
91
- The starter project example also includes a batch file [build.bat](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/starter/build.bat) that compresses everything into a tiny zip file using Google Closure, UglifyJS, Roadroller, and ECT.
94
+ The starter example project also includes a node js file [build.js](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/starter/build.js) that compresses everything into a tiny zip file using Google Closure, UglifyJS, and ECT Zip.
95
+
96
+ ## Engine Source Code
97
+
98
+ This engine is made with simplicity in mind using clean easy to read code. There are only a few files used by the entire engine.
99
+
100
+ - [engine.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engine.js) - Top level engine init, update, and render
101
+ - [engineSettings.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineSettings.js) - Global engine settings
102
+ - [engineObject.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineObject.js) - Base object class and physics
103
+ - [engineDraw.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDraw.js) - Code for canvas drawing and text
104
+ - [engineAudio.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineAudio.js) - Spacial sound effects, and zzfx sound generator
105
+ - [engineInput.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineInput.js) - Input for keyboard, mouse, touch, and gamepad
106
+ - [engineUtilities.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineUtilities.js) - Vector2, Color, and Timer clases and math functions
107
+
108
+ Optional Components, these components are built to synergize with the rest of the engine but are not necessary.
109
+
110
+ - [engineTileLayer.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineTileLayer.js) - Tile layer rendering and collision
111
+ - [engineParticles.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineParticles.js) - Particle system with fast rendering and collision
112
+ - [engineWebGL.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineWebGL.js) - Super fast rendering with WebGL and post processing
113
+ - [engineMedals.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineMedals.js) - Achievement tracker with Newgrounds integration
114
+ - [engineDebug.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDebug.js) - Debug rendering system and information overlay
115
+ - [engineExport.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineExport.js) - Included when exporting engine as a module
116
+ - [engineBuild.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineBuild.js) - Node script used to build the engine
92
117
 
93
118
  ## LittleJS Setup
94
119
 
@@ -157,26 +182,6 @@ class MyObject extends EngineObject
157
182
  }
158
183
  ```
159
184
 
160
- ## Engine Source Code
161
-
162
- This engine is made with simplicity in mind using clean easy to read code. There are only a few files used by the entire engine.
163
-
164
- - [engine.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engine.js) - Top level engine init, update, and render
165
- - [engineSettings.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineSettings.js) - Global engine settings
166
- - [engineObject.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineObject.js) - Base object class and physics
167
- - [engineDraw.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDraw.js) - Code for canvas drawing and text
168
- - [engineAudio.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineAudio.js) - Spacial sound effects, and zzfx sound generator
169
- - [engineInput.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineInput.js) - Input for keyboard, mouse, touch, and gamepad
170
- - [engineUtilities.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineUtilities.js) - Vector2, Color, and Timer clases and math functions
171
-
172
- Optional Components, these components are built to synergize with the rest of the engine but are not necessary.
173
-
174
- - [engineTileLayer.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineTileLayer.js) - Tile layer rendering and collision
175
- - [engineParticles.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineParticles.js) - Particle system with fast rendering and collision
176
- - [engineWebGL.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineWebGL.js) - Super fast rendering with WebGL and post processing
177
- - [engineMedals.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineMedals.js) - Achievement tracker with Newgrounds integration
178
- - [engineDebug.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDebug.js) - Debug rendering system and information overlay
179
-
180
185
  ## Debugging
181
186
 
182
187
  Debug builds of LittleJS have a special menu that can be opened by pressing the Esc key.
@@ -185,7 +190,7 @@ Debug builds of LittleJS have a special menu that can be opened by pressing the
185
190
  - 1: Debug Physics
186
191
  - 2: Debug Particles
187
192
  - 3: Debug Gamepads
188
- - 4: God Mode
193
+ - 4: Debug Raycasts
189
194
  - 5: Save Screenshot
190
195
 
191
196
  ## Games Made With LittleJS
@@ -205,3 +210,14 @@ Here are a few of the amazing games people are making with LittleJS.
205
210
  - Send me your games!
206
211
 
207
212
  ![LittleJS Logo](examples/favicon.png)
213
+
214
+ [npm]: https://img.shields.io/npm/v/littlejsengine
215
+ [npm-url]: https://www.npmjs.com/package/littlejsengine
216
+ [build-size]: https://badgen.net/bundlephobia/minzip/littlejsengine?1
217
+ [build-size-url]: https://bundlephobia.com/result?p=littlejsengine
218
+ [npm-downloads]: https://img.shields.io/npm/dw/littlejsengine
219
+ [npmtrends-url]: https://www.npmtrends.com/littlejsengine
220
+ [deepscan]: https://deepscan.io/api/teams/22950/projects/26229/branches/831487/badge/grade.svg
221
+ [deepscan-url]: https://deepscan.io/dashboard#view=project&tid=22950&pid=26229&bid=831487
222
+ [discord]: https://img.shields.io/discord/939926111469568050
223
+ [discord-url]: https://discord.gg/zb7hcGkyZe
@@ -146,15 +146,11 @@ declare module "littlejs.esm" {
146
146
  /** Set to stop medals from being unlockable
147
147
  * @param {Boolean} preventUnlock
148
148
  * @memberof Settings */
149
- export function setMedalsPreventUnlock(prevent: any): void;
149
+ export function setMedalsPreventUnlock(preventUnlock: boolean): void;
150
150
  /** Set if watermark with FPS should be shown
151
151
  * @param {Boolean} show
152
152
  * @memberof Debug */
153
153
  export function setShowWatermark(show: boolean): void;
154
- /** Set if god mode is enabled
155
- * @param {Boolean} enable
156
- * @memberof Debug */
157
- export function setGodMode(enable: boolean): void;
158
154
  /** Set key code used to toggle debug mode, Esc by default
159
155
  * @param {Number} key
160
156
  * @memberof Debug */
@@ -347,11 +343,6 @@ declare module "littlejs.esm" {
347
343
  * @default
348
344
  * @memberof Debug */
349
345
  export let showWatermark: boolean;
350
- /** True if god mode is enabled, handle this however you want
351
- * @type {Boolean}
352
- * @default
353
- * @memberof Debug */
354
- export let godMode: boolean;
355
346
  /** Asserts if the experssion is false, does not do anything in release builds
356
347
  * @param {Boolean} assertion
357
348
  * @param {Object} output
@@ -424,69 +415,69 @@ declare module "littlejs.esm" {
424
415
  * @param {Number} value
425
416
  * @return {Number}
426
417
  * @memberof Utilities */
427
- export function abs(a: any): number;
418
+ export function abs(value: number): number;
428
419
  /** Returns lowest of two values passed in
429
420
  * @param {Number} valueA
430
421
  * @param {Number} valueB
431
422
  * @return {Number}
432
423
  * @memberof Utilities */
433
- export function min(a: any, b: any): number;
424
+ export function min(valueA: number, valueB: number): number;
434
425
  /** Returns highest of two values passed in
435
426
  * @param {Number} valueA
436
427
  * @param {Number} valueB
437
428
  * @return {Number}
438
429
  * @memberof Utilities */
439
- export function max(a: any, b: any): number;
430
+ export function max(valueA: number, valueB: number): number;
440
431
  /** Returns the sign of value passed in (also returns 1 if 0)
441
432
  * @param {Number} value
442
433
  * @return {Number}
443
434
  * @memberof Utilities */
444
- export function sign(a: any): number;
435
+ export function sign(value: number): number;
445
436
  /** Returns first parm modulo the second param, but adjusted so negative numbers work as expected
446
437
  * @param {Number} dividend
447
438
  * @param {Number} [divisor=1]
448
439
  * @return {Number}
449
440
  * @memberof Utilities */
450
- export function mod(a: any, b?: number): number;
441
+ export function mod(dividend: number, divisor?: number): number;
451
442
  /** Clamps the value beween max and min
452
443
  * @param {Number} value
453
444
  * @param {Number} [min=0]
454
445
  * @param {Number} [max=1]
455
446
  * @return {Number}
456
447
  * @memberof Utilities */
457
- export function clamp(v: any, min?: number, max?: number): number;
448
+ export function clamp(value: number, min?: number, max?: number): number;
458
449
  /** Returns what percentage the value is between max and min
459
450
  * @param {Number} value
460
451
  * @param {Number} [min=0]
461
452
  * @param {Number} [max=1]
462
453
  * @return {Number}
463
454
  * @memberof Utilities */
464
- export function percent(v: any, min?: number, max?: number): number;
455
+ export function percent(value: number, min?: number, max?: number): number;
465
456
  /** Linearly interpolates the percent value between max and min
466
457
  * @param {Number} percent
467
458
  * @param {Number} [min=0]
468
459
  * @param {Number} [max=1]
469
460
  * @return {Number}
470
461
  * @memberof Utilities */
471
- export function lerp(p: any, min?: number, max?: number): number;
462
+ export function lerp(percent: number, min?: number, max?: number): number;
472
463
  /** Applies smoothstep function to the percentage value
473
- * @param {Number} value
464
+ * @param {Number} percent
474
465
  * @return {Number}
475
466
  * @memberof Utilities */
476
- export function smoothStep(p: any): number;
467
+ export function smoothStep(percent: number): number;
477
468
  /** Returns the nearest power of two not less then the value
478
469
  * @param {Number} value
479
470
  * @return {Number}
480
471
  * @memberof Utilities */
481
- export function nearestPowerOfTwo(v: any): number;
472
+ export function nearestPowerOfTwo(value: number): number;
482
473
  /** Returns true if two axis aligned bounding boxes are overlapping
483
474
  * @param {Vector2} pointA - Center of box A
484
475
  * @param {Vector2} sizeA - Size of box A
485
476
  * @param {Vector2} pointB - Center of box B
486
- * @param {Vector2} [sizeB] - Size of box B
477
+ * @param {Vector2} sizeB - Size of box B
487
478
  * @return {Boolean} - True if overlapping
488
479
  * @memberof Utilities */
489
- export function isOverlapping(pA: any, sA: any, pB: any, sB: any): boolean;
480
+ export function isOverlapping(pointA: Vector2, sizeA: Vector2, pointB: Vector2, sizeB: Vector2): boolean;
490
481
  /** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
491
482
  * @param {Number} [frequency=1] - Frequency of the wave in Hz
492
483
  * @param {Number} [amplitude=1] - Amplitude (max height) of the wave
@@ -506,13 +497,13 @@ declare module "littlejs.esm" {
506
497
  * @param {Number} [valueB=0]
507
498
  * @return {Number}
508
499
  * @memberof Random */
509
- export function rand(a?: number, b?: number): number;
500
+ export function rand(valueA?: number, valueB?: number): number;
510
501
  /** Returns a floored random value the two values passed in
511
502
  * @param {Number} [valueA=1]
512
503
  * @param {Number} [valueB=0]
513
504
  * @return {Number}
514
505
  * @memberof Random */
515
- export function randInt(a?: number, b?: number): number;
506
+ export function randInt(valueA?: number, valueB?: number): number;
516
507
  /** Randomly returns either -1 or 1
517
508
  * @return {Number}
518
509
  * @memberof Random */
@@ -534,7 +525,7 @@ declare module "littlejs.esm" {
534
525
  * @param {Boolean} [linear]
535
526
  * @return {Color}
536
527
  * @memberof Random */
537
- export function randColor(cA?: Color, cB?: Color, linear?: boolean): Color;
528
+ export function randColor(colorA?: Color, colorB?: Color, linear?: boolean): Color;
538
529
  /** Seed used by the randSeeded function
539
530
  * @type {Number}
540
531
  * @default
@@ -549,7 +540,7 @@ declare module "littlejs.esm" {
549
540
  * @param {Number} [valueB=0]
550
541
  * @return {Number}
551
542
  * @memberof Random */
552
- export function randSeeded(a?: number, b?: number): number;
543
+ export function randSeeded(valueA?: number, valueB?: number): number;
553
544
  /**
554
545
  * 2D Vector object with vector math library
555
546
  * - Functions do not change this so they can be chained together
@@ -572,25 +563,25 @@ declare module "littlejs.esm" {
572
563
  * @return {Vector2} */
573
564
  copy(): Vector2;
574
565
  /** Returns a copy of this vector plus the vector passed in
575
- * @param {Vector2} vector
566
+ * @param {Vector2} v - other vector
576
567
  * @return {Vector2} */
577
- add(v: any): Vector2;
568
+ add(v: Vector2): Vector2;
578
569
  /** Returns a copy of this vector minus the vector passed in
579
- * @param {Vector2} vector
570
+ * @param {Vector2} v - other vector
580
571
  * @return {Vector2} */
581
- subtract(v: any): Vector2;
572
+ subtract(v: Vector2): Vector2;
582
573
  /** Returns a copy of this vector times the vector passed in
583
- * @param {Vector2} vector
574
+ * @param {Vector2} v - other vector
584
575
  * @return {Vector2} */
585
- multiply(v: any): Vector2;
576
+ multiply(v: Vector2): Vector2;
586
577
  /** Returns a copy of this vector divided by the vector passed in
587
- * @param {Vector2} vector
578
+ * @param {Vector2} v - other vector
588
579
  * @return {Vector2} */
589
- divide(v: any): Vector2;
580
+ divide(v: Vector2): Vector2;
590
581
  /** Returns a copy of this vector scaled by the vector passed in
591
- * @param {Number} scale
582
+ * @param {Number} s - scale
592
583
  * @return {Vector2} */
593
- scale(s: any): Vector2;
584
+ scale(s: number): Vector2;
594
585
  /** Returns the length of this vector
595
586
  * @return {Number} */
596
587
  length(): number;
@@ -598,13 +589,13 @@ declare module "littlejs.esm" {
598
589
  * @return {Number} */
599
590
  lengthSquared(): number;
600
591
  /** Returns the distance from this vector to vector passed in
601
- * @param {Vector2} vector
592
+ * @param {Vector2} v - other vector
602
593
  * @return {Number} */
603
- distance(v: any): number;
594
+ distance(v: Vector2): number;
604
595
  /** Returns the distance squared from this vector to vector passed in
605
- * @param {Vector2} vector
596
+ * @param {Vector2} v - other vector
606
597
  * @return {Number} */
607
- distanceSquared(v: any): number;
598
+ distanceSquared(v: Vector2): number;
608
599
  /** Returns a new vector in same direction as this one with the length passed in
609
600
  * @param {Number} [length=1]
610
601
  * @return {Vector2} */
@@ -614,13 +605,13 @@ declare module "littlejs.esm" {
614
605
  * @return {Vector2} */
615
606
  clampLength(length?: number): Vector2;
616
607
  /** Returns the dot product of this and the vector passed in
617
- * @param {Vector2} vector
608
+ * @param {Vector2} v - other vector
618
609
  * @return {Number} */
619
- dot(v: any): number;
610
+ dot(v: Vector2): number;
620
611
  /** Returns the cross product of this and the vector passed in
621
- * @param {Vector2} vector
612
+ * @param {Vector2} v - other vector
622
613
  * @return {Number} */
623
- cross(v: any): number;
614
+ cross(v: Vector2): number;
624
615
  /** Returns the angle of this vector, up is angle 0
625
616
  * @return {Number} */
626
617
  angle(): number;
@@ -628,11 +619,11 @@ declare module "littlejs.esm" {
628
619
  * @param {Number} [angle=0]
629
620
  * @param {Number} [length=1]
630
621
  * @return {Vector2} */
631
- setAngle(a?: number, length?: number): Vector2;
622
+ setAngle(angle?: number, length?: number): Vector2;
632
623
  /** Returns copy of this vector rotated by the angle passed in
633
624
  * @param {Number} angle
634
625
  * @return {Vector2} */
635
- rotate(a: any): Vector2;
626
+ rotate(angle: number): Vector2;
636
627
  /** Returns the integer direction of this vector, corrosponding to multiples of 90 degree rotation (0-3)
637
628
  * @return {Number} */
638
629
  direction(): number;
@@ -646,10 +637,10 @@ declare module "littlejs.esm" {
646
637
  * @return {Number} */
647
638
  area(): number;
648
639
  /** Returns a new vector that is p percent between this and the vector passed in
649
- * @param {Vector2} vector
640
+ * @param {Vector2} v - other vector
650
641
  * @param {Number} percent
651
642
  * @return {Vector2} */
652
- lerp(v: any, p: any): Vector2;
643
+ lerp(v: Vector2, percent: number): Vector2;
653
644
  /** Returns true if this vector is within the bounds of an array size passed in
654
645
  * @param {Vector2} arraySize
655
646
  * @return {Boolean} */
@@ -669,11 +660,11 @@ declare module "littlejs.esm" {
669
660
  * let e = HSL(.3, 1, .5); // green using hsl color
670
661
  */
671
662
  export class Color {
672
- /** Create a color with the components passed in, white by default
673
- * @param {Number} [red=1]
674
- * @param {Number} [green=1]
675
- * @param {Number} [blue=1]
676
- * @param {Number} [alpha=1] */
663
+ /** Create a color with the rgba components passed in, white by default
664
+ * @param {Number} [r=1] - red
665
+ * @param {Number} [g=1] - green
666
+ * @param {Number} [b=1] - blue
667
+ * @param {Number} [a=1] - alpha*/
677
668
  constructor(r?: number, g?: number, b?: number, a?: number);
678
669
  /** @property {Number} - Red */
679
670
  r: number;
@@ -687,39 +678,39 @@ declare module "littlejs.esm" {
687
678
  * @return {Color} */
688
679
  copy(): Color;
689
680
  /** Returns a copy of this color plus the color passed in
690
- * @param {Color} color
681
+ * @param {Color} c - other color
691
682
  * @return {Color} */
692
- add(c: any): Color;
683
+ add(c: Color): Color;
693
684
  /** Returns a copy of this color minus the color passed in
694
- * @param {Color} color
685
+ * @param {Color} c - other color
695
686
  * @return {Color} */
696
- subtract(c: any): Color;
687
+ subtract(c: Color): Color;
697
688
  /** Returns a copy of this color times the color passed in
698
- * @param {Color} color
689
+ * @param {Color} c - other color
699
690
  * @return {Color} */
700
- multiply(c: any): Color;
691
+ multiply(c: Color): Color;
701
692
  /** Returns a copy of this color divided by the color passed in
702
- * @param {Color} color
693
+ * @param {Color} c - other color
703
694
  * @return {Color} */
704
- divide(c: any): Color;
695
+ divide(c: Color): Color;
705
696
  /** Returns a copy of this color scaled by the value passed in, alpha can be scaled separately
706
697
  * @param {Number} scale
707
698
  * @param {Number} [alphaScale=scale]
708
699
  * @return {Color} */
709
- scale(s: any, a?: any): Color;
700
+ scale(scale: number, alphaScale?: number): Color;
710
701
  /** Returns a copy of this color clamped to the valid range between 0 and 1
711
702
  * @return {Color} */
712
703
  clamp(): Color;
713
704
  /** Returns a new color that is p percent between this and the color passed in
714
- * @param {Color} color
705
+ * @param {Color} c - other color
715
706
  * @param {Number} percent
716
707
  * @return {Color} */
717
- lerp(c: any, p: any): Color;
708
+ lerp(c: Color, percent: number): Color;
718
709
  /** Sets this color given a hue, saturation, lightness, and alpha
719
- * @param {Number} [hue=0]
720
- * @param {Number} [saturation=0]
721
- * @param {Number} [lightness=1]
722
- * @param {Number} [alpha=1]
710
+ * @param {Number} [h=0] - hue
711
+ * @param {Number} [s=0] - saturation
712
+ * @param {Number} [l=1] - lightness
713
+ * @param {Number} [a=1] - alpha
723
714
  * @return {Color} */
724
715
  setHSLA(h?: number, s?: number, l?: number, a?: number): Color;
725
716
  /** Returns this color expressed in hsla format
@@ -799,20 +790,20 @@ declare module "littlejs.esm" {
799
790
  export function vec2(x?: number, y?: number): Vector2;
800
791
  /**
801
792
  * Create a color object with RGBA values
802
- * @param {Number} [r=1]
803
- * @param {Number} [g=1]
804
- * @param {Number} [b=1]
805
- * @param {Number} [a=1]
793
+ * @param {Number} [r=1] - red
794
+ * @param {Number} [g=1] - green
795
+ * @param {Number} [b=1] - blue
796
+ * @param {Number} [a=1] - alpha
806
797
  * @return {Color}
807
798
  * @memberof Utilities
808
799
  */
809
800
  export function rgb(r?: number, g?: number, b?: number, a?: number): Color;
810
801
  /**
811
802
  * Create a color object with HSLA values
812
- * @param {Number} [h=0]
813
- * @param {Number} [s=0]
814
- * @param {Number} [l=1]
815
- * @param {Number} [a=1]
803
+ * @param {Number} [h=0] - hue
804
+ * @param {Number} [s=0] - saturation
805
+ * @param {Number} [l=1] - lightness
806
+ * @param {Number} [a=1] - alpha
816
807
  * @return {Color}
817
808
  * @memberof Utilities
818
809
  */
@@ -908,13 +899,13 @@ declare module "littlejs.esm" {
908
899
  * @param {EngineObject} object - the object to test against
909
900
  * @return {Boolean} - true if the collision should be resolved
910
901
  */
911
- collideWithObject(o: any): boolean;
902
+ collideWithObject(object: EngineObject): boolean;
912
903
  /** How long since the object was created
913
904
  * @return {Number} */
914
905
  getAliveTime(): number;
915
906
  /** Apply acceleration to this object (adjust velocity, not affected by mass)
916
907
  * @param {Vector2} acceleration */
917
- applyAcceleration(a: any): void;
908
+ applyAcceleration(acceleration: Vector2): void;
918
909
  /** Apply force to this object (adjust velocity, affected by mass)
919
910
  * @param {Vector2} force */
920
911
  applyForce(force: Vector2): void;
@@ -1371,7 +1362,7 @@ declare module "littlejs.esm" {
1371
1362
  * @return {Boolean}
1372
1363
  * @memberof TileCollision */
1373
1364
  export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
1374
- /** Return the center of tile if any that is hit (this does not return the exact hit point)
1365
+ /** Return the center of tile if any that is hit (does not return the exact intersection)
1375
1366
  * @param {Vector2} posStart
1376
1367
  * @param {Vector2} posEnd
1377
1368
  * @param {EngineObject} [object]