littlejsengine 1.9.1 → 1.9.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 +11 -9
- package/{build → dist}/littlejs.d.ts +48 -43
- package/{build → dist}/littlejs.esm.js +256 -147
- package/dist/littlejs.esm.min.js +1 -0
- package/{build → dist}/littlejs.js +256 -147
- package/dist/littlejs.min.js +1 -0
- package/{build → dist}/littlejs.release.js +249 -144
- package/examples/breakout/game.js +2 -2
- package/examples/breakout/gameObjects.js +3 -3
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/build.js +1 -1
- package/examples/electron/game.js +49 -38
- package/examples/electron/index.html +2 -2
- package/examples/electron/tiles.png +0 -0
- package/examples/empty/index.html +1 -1
- package/examples/js13k/build.js +1 -1
- package/examples/js13k/game.js +10 -9
- package/examples/js13k/index.html +13 -13
- package/examples/js13k/tiles.png +0 -0
- package/examples/logo.png +0 -0
- package/examples/module/game.js +45 -41
- package/examples/module/index.html +1 -1
- package/examples/module/tiles.png +0 -0
- package/examples/particles/index.html +1 -1
- package/examples/platformer/data/gameLevelData.tmx +143 -0
- package/examples/platformer/data/gameLevelData.tsx +4 -0
- package/examples/platformer/game.js +31 -11
- package/examples/platformer/gameCharacter.js +9 -7
- package/examples/platformer/gameEffects.js +105 -164
- package/examples/platformer/gameLevel.js +164 -181
- package/examples/platformer/gameLevelData.js +181 -0
- package/examples/platformer/gameObjects.js +71 -26
- package/examples/platformer/gamePlayer.js +3 -2
- package/examples/platformer/index.html +8 -7
- package/examples/platformer/tiles.png +0 -0
- package/examples/platformer/tilesLevel.png +0 -0
- package/examples/puzzle/game.js +12 -12
- package/examples/puzzle/index.html +2 -2
- package/examples/screenshot.jpg +0 -0
- package/examples/starter/build.js +1 -1
- package/examples/starter/game.js +6 -6
- package/examples/starter/index.html +13 -13
- package/examples/starter/tiles.png +0 -0
- package/examples/stress/index.html +2 -2
- package/examples/typescript/build.bat +4 -1
- package/examples/typescript/game.js +34 -31
- package/examples/typescript/game.ts +40 -36
- package/examples/typescript/index.html +1 -1
- package/examples/typescript/tiles.png +0 -0
- package/package.json +3 -3
- package/reference.md +409 -0
- package/src/engine.js +46 -41
- package/src/engineAudio.js +22 -19
- package/src/engineBuild.js +9 -2
- package/src/engineDebug.js +7 -3
- package/src/engineDraw.js +8 -7
- package/src/engineInput.js +5 -5
- package/src/engineMedals.js +3 -3
- package/src/engineObject.js +2 -2
- package/src/engineParticles.js +16 -15
- package/src/engineSettings.js +3 -3
- package/src/engineTileLayer.js +3 -3
- package/src/engineUtilities.js +139 -38
- package/src/engineWebGL.js +2 -8
- package/build/littlejs.esm.min.js +0 -1
- package/build/littlejs.min.js +0 -1
- package/index.d.ts +0 -2094
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
## 🚂 All aboard!
|
|
16
16
|
|
|
17
17
|
LittleJS is a fast lightweight open source HTML5 game engine for modern web development.
|
|
18
|
-
|
|
18
|
+
Its small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound effects, music, and input handling.
|
|
19
19
|
The code is very clean and well documented with some fun examples to get you started. Choo-Choo!
|
|
20
20
|
|
|
21
21
|
### 🚀 Join the First Ever LittleJS Game Jam
|
|
@@ -24,7 +24,7 @@ The code is very clean and well documented with some fun examples to get you sta
|
|
|
24
24
|
|
|
25
25
|
<div align="center">
|
|
26
26
|
|
|
27
|
-
## [Demo](https://killedbyapixel.github.io/LittleJS/examples/starter/) | [Docs](https://killedbyapixel.github.io/LittleJS/docs) | [Trailer](https://youtu.be/chuBzGjv7Ms) | [Discord](https://discord.gg/zb7hcGkyZe) | [Tutorial](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/breakoutTutorial/README.md)
|
|
27
|
+
## [Demo](https://killedbyapixel.github.io/LittleJS/examples/starter/) | [Docs](https://killedbyapixel.github.io/LittleJS/docs) | [Trailer](https://youtu.be/chuBzGjv7Ms) | [Discord](https://discord.gg/zb7hcGkyZe) | [Tutorial](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/breakoutTutorial/README.md) | [Quick Reference](https://github.com/KilledByAPixel/LittleJS/blob/main/reference.md)
|
|
28
28
|
|
|
29
29
|
</div>
|
|
30
30
|
|
|
@@ -54,7 +54,7 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
54
54
|
|
|
55
55
|
### 💥 Physics
|
|
56
56
|
|
|
57
|
-
- Robust
|
|
57
|
+
- Robust arcade physics system with collision handling
|
|
58
58
|
- Very fast collision and raycasting for tile maps
|
|
59
59
|
|
|
60
60
|
### 🚀 Flexibility
|
|
@@ -80,6 +80,8 @@ To get started download the latest LittleJS package from GitHub or install via n
|
|
|
80
80
|
|
|
81
81
|
Learn how to make a simple game from scratch with [The Breakout Tutorial.](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial)
|
|
82
82
|
|
|
83
|
+
[LittleJS Engine Quick Reference Sheet](https://github.com/KilledByAPixel/LittleJS/blob/main/reference.md) - This cheat sheet can help you get started.
|
|
84
|
+
|
|
83
85
|
[Watch this GitNation talk](https://youtu.be/_dXKU0WgAj8?si=ZDXLYAFDWp54hrGT) to hear more about LittleJS works and get some tips on how to use it.
|
|
84
86
|
|
|
85
87
|
Join our vibrant community on [Discord](https://discord.gg/zb7hcGkyZe) to get help, share your projects, and collaborate with others!
|
|
@@ -91,7 +93,7 @@ These examples are for both learning and using as starter projects to create you
|
|
|
91
93
|
- [Starter Project](https://killedbyapixel.github.io/LittleJS/examples/starter/) - Clean example with only a few things to get you started
|
|
92
94
|
- [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout/) - Block breaking game with post-processing effects
|
|
93
95
|
- [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle/) - Match 3 puzzle game with HD rendering and high score tracking
|
|
94
|
-
- [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter with
|
|
96
|
+
- [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer/) - Platformer/shooter with level data from [Tiled Editor](https://github.com/mapeditor/tiled)
|
|
95
97
|
- [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress/) - Max sprite/object test and music system demo
|
|
96
98
|
- [Particle System Designer](https://killedbyapixel.github.io/LittleJS/examples/particles/) - Particle system editor and visualizer
|
|
97
99
|
|
|
@@ -99,11 +101,11 @@ These examples are for both learning and using as starter projects to create you
|
|
|
99
101
|
|
|
100
102
|
To easily include LittleJS in your game, you can use one of the pre-built js files.
|
|
101
103
|
|
|
102
|
-
- [littlejs.js](https://github.com/KilledByAPixel/LittleJS/blob/main/
|
|
103
|
-
- [littlejs.release.js](https://github.com/KilledByAPixel/LittleJS/blob/main/
|
|
104
|
-
- [littlejs.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/
|
|
105
|
-
- [littlejs.esm.js](https://github.com/KilledByAPixel/LittleJS/blob/main/
|
|
106
|
-
- [littlejs.esm.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/
|
|
104
|
+
- [littlejs.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.js) - The full game engine with debug mode available
|
|
105
|
+
- [littlejs.release.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.release.js) - The engine optimized for release builds
|
|
106
|
+
- [littlejs.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.min.js) - The engine in release mode and minified
|
|
107
|
+
- [littlejs.esm.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.esm.js) - The engine exported as a module with debug mode available
|
|
108
|
+
- [littlejs.esm.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/dist/littlejs.esm.min.js) - The engine exported as a minified module in release mode
|
|
107
109
|
|
|
108
110
|
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.
|
|
109
111
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare module "littlejs.esm" {
|
|
2
2
|
/**
|
|
3
|
-
* LittleJS - The Tiny JavaScript Game Engine
|
|
3
|
+
* LittleJS - The Tiny Fast JavaScript Game Engine
|
|
4
4
|
* MIT License - Copyright 2021 Frank Force
|
|
5
5
|
*
|
|
6
6
|
* Engine Features
|
|
@@ -28,7 +28,7 @@ declare module "littlejs.esm" {
|
|
|
28
28
|
* @default
|
|
29
29
|
* @memberof Engine */
|
|
30
30
|
export const engineVersion: string;
|
|
31
|
-
/** Frames per second to update
|
|
31
|
+
/** Frames per second to update
|
|
32
32
|
* @type {Number}
|
|
33
33
|
* @default
|
|
34
34
|
* @memberof Engine */
|
|
@@ -46,7 +46,7 @@ declare module "littlejs.esm" {
|
|
|
46
46
|
* @type {Number}
|
|
47
47
|
* @memberof Engine */
|
|
48
48
|
export let frame: number;
|
|
49
|
-
/** Current engine time since start in seconds
|
|
49
|
+
/** Current engine time since start in seconds
|
|
50
50
|
* @type {Number}
|
|
51
51
|
* @memberof Engine */
|
|
52
52
|
export let time: number;
|
|
@@ -63,12 +63,12 @@ declare module "littlejs.esm" {
|
|
|
63
63
|
* @param {Boolean} isPaused
|
|
64
64
|
* @memberof Engine */
|
|
65
65
|
export function setPaused(isPaused: boolean): void;
|
|
66
|
-
/**
|
|
67
|
-
* @param {Function} gameInit
|
|
68
|
-
* @param {Function} gameUpdate
|
|
69
|
-
* @param {Function} gameUpdatePost
|
|
70
|
-
* @param {Function} gameRender
|
|
71
|
-
* @param {Function} gameRenderPost
|
|
66
|
+
/** Startup LittleJS engine with your callback functions
|
|
67
|
+
* @param {Function} gameInit - Called once after the engine starts up, setup the game
|
|
68
|
+
* @param {Function} gameUpdate - Called every frame at 60 frames per second, handle input and update the game state
|
|
69
|
+
* @param {Function} gameUpdatePost - Called after physics and objects are updated, setup camera and prepare for render
|
|
70
|
+
* @param {Function} gameRender - Called before objects are rendered, draw any background effects that appear behind objects
|
|
71
|
+
* @param {Function} gameRenderPost - Called after objects are rendered, draw effects or hud that appear above all objects
|
|
72
72
|
* @param {Array} [imageSources=['tiles.png']] - Image to load
|
|
73
73
|
* @memberof Engine */
|
|
74
74
|
export function engineInit(gameInit: Function, gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: any[]): void;
|
|
@@ -109,11 +109,11 @@ declare module "littlejs.esm" {
|
|
|
109
109
|
* @default
|
|
110
110
|
* @memberof Debug */
|
|
111
111
|
export let showWatermark: boolean;
|
|
112
|
-
/** Asserts if the
|
|
112
|
+
/** Asserts if the expression is false, does not do anything in release builds
|
|
113
113
|
* @param {Boolean} assert
|
|
114
|
-
* @param {Object} output
|
|
114
|
+
* @param {Object} [output]
|
|
115
115
|
* @memberof Debug */
|
|
116
|
-
export function ASSERT(assert: boolean, output
|
|
116
|
+
export function ASSERT(assert: boolean, output?: any): void;
|
|
117
117
|
/** Draw a debug rectangle in world space
|
|
118
118
|
* @param {Vector2} pos
|
|
119
119
|
* @param {Vector2} [size=Vector2()]
|
|
@@ -229,7 +229,7 @@ declare module "littlejs.esm" {
|
|
|
229
229
|
* @default
|
|
230
230
|
* @memberof Settings */
|
|
231
231
|
export let enablePhysicsSolver: boolean;
|
|
232
|
-
/** Default object mass for
|
|
232
|
+
/** Default object mass for collision calcuations (how heavy objects are)
|
|
233
233
|
* @type {Number}
|
|
234
234
|
* @default
|
|
235
235
|
* @memberof Settings */
|
|
@@ -306,7 +306,7 @@ declare module "littlejs.esm" {
|
|
|
306
306
|
* @default
|
|
307
307
|
* @memberof Settings */
|
|
308
308
|
export let touchGamepadAnalog: boolean;
|
|
309
|
-
/** Size of
|
|
309
|
+
/** Size of virtual gamepad for touch devices in pixels
|
|
310
310
|
* @type {Number}
|
|
311
311
|
* @default
|
|
312
312
|
* @memberof Settings */
|
|
@@ -548,7 +548,7 @@ declare module "littlejs.esm" {
|
|
|
548
548
|
* @return {Number}
|
|
549
549
|
* @memberof Utilities */
|
|
550
550
|
export function max(valueA: number, valueB: number): number;
|
|
551
|
-
/** Returns the sign of value passed in
|
|
551
|
+
/** Returns the sign of value passed in
|
|
552
552
|
* @param {Number} value
|
|
553
553
|
* @return {Number}
|
|
554
554
|
* @memberof Utilities */
|
|
@@ -580,7 +580,7 @@ declare module "littlejs.esm" {
|
|
|
580
580
|
* @returns {Number}
|
|
581
581
|
* @memberof Utilities */
|
|
582
582
|
export function distanceWrap(valueA: number, valueB: number, wrapSize?: number): number;
|
|
583
|
-
/** Linearly interpolates between values passed in with
|
|
583
|
+
/** Linearly interpolates between values passed in with wrapping
|
|
584
584
|
* @param {Number} percent
|
|
585
585
|
* @param {Number} valueA
|
|
586
586
|
* @param {Number} valueB
|
|
@@ -594,7 +594,7 @@ declare module "littlejs.esm" {
|
|
|
594
594
|
* @returns {Number}
|
|
595
595
|
* @memberof Utilities */
|
|
596
596
|
export function distanceAngle(angleA: number, angleB: number): number;
|
|
597
|
-
/** Linearly interpolates between the angles passed in with
|
|
597
|
+
/** Linearly interpolates between the angles passed in with wrapping
|
|
598
598
|
* @param {Number} percent
|
|
599
599
|
* @param {Number} angleA
|
|
600
600
|
* @param {Number} angleB
|
|
@@ -619,13 +619,13 @@ declare module "littlejs.esm" {
|
|
|
619
619
|
* @memberof Utilities */
|
|
620
620
|
export function nearestPowerOfTwo(value: number): number;
|
|
621
621
|
/** Returns true if two axis aligned bounding boxes are overlapping
|
|
622
|
-
* @param {Vector2} pointA
|
|
623
|
-
* @param {Vector2} sizeA
|
|
624
|
-
* @param {Vector2} pointB
|
|
625
|
-
* @param {Vector2} sizeB - Size of box B
|
|
626
|
-
* @return {Boolean}
|
|
622
|
+
* @param {Vector2} pointA - Center of box A
|
|
623
|
+
* @param {Vector2} sizeA - Size of box A
|
|
624
|
+
* @param {Vector2} pointB - Center of box B
|
|
625
|
+
* @param {Vector2} [sizeB=(0,0)] - Size of box B, a point if undefined
|
|
626
|
+
* @return {Boolean} - True if overlapping
|
|
627
627
|
* @memberof Utilities */
|
|
628
|
-
export function isOverlapping(pointA: Vector2, sizeA: Vector2, pointB: Vector2, sizeB
|
|
628
|
+
export function isOverlapping(pointA: Vector2, sizeA: Vector2, pointB: Vector2, sizeB?: Vector2): boolean;
|
|
629
629
|
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
630
630
|
* @param {Number} [frequency] - Frequency of the wave in Hz
|
|
631
631
|
* @param {Number} [amplitude] - Amplitude (max height) of the wave
|
|
@@ -668,8 +668,8 @@ declare module "littlejs.esm" {
|
|
|
668
668
|
* @memberof Random */
|
|
669
669
|
export function randVector(length?: number): Vector2;
|
|
670
670
|
/** Returns a random color between the two passed in colors, combine components if linear
|
|
671
|
-
* @param {Color} [colorA=
|
|
672
|
-
* @param {Color} [colorB=
|
|
671
|
+
* @param {Color} [colorA=(1,1,1,1)]
|
|
672
|
+
* @param {Color} [colorB=(0,0,0,1)]
|
|
673
673
|
* @param {Boolean} [linear]
|
|
674
674
|
* @return {Color}
|
|
675
675
|
* @memberof Random */
|
|
@@ -787,6 +787,10 @@ declare module "littlejs.esm" {
|
|
|
787
787
|
* @param {Number} angle
|
|
788
788
|
* @return {Vector2} */
|
|
789
789
|
rotate(angle: number): Vector2;
|
|
790
|
+
/** Set the integer direction of this vector, corrosponding to multiples of 90 degree rotation (0-3)
|
|
791
|
+
* @param {Number} [direction]
|
|
792
|
+
* @param {Number} [length] */
|
|
793
|
+
setDirection(direction?: number, length?: number): Vector2;
|
|
790
794
|
/** Returns the integer direction of this vector, corrosponding to multiples of 90 degree rotation (0-3)
|
|
791
795
|
* @return {Number} */
|
|
792
796
|
direction(): number;
|
|
@@ -819,8 +823,8 @@ declare module "littlejs.esm" {
|
|
|
819
823
|
* let a = new Color; // white
|
|
820
824
|
* let b = new Color(1, 0, 0); // red
|
|
821
825
|
* let c = new Color(0, 0, 0, 0); // transparent black
|
|
822
|
-
* let d =
|
|
823
|
-
* let e =
|
|
826
|
+
* let d = rgb(0, 0, 1); // blue using rgb color
|
|
827
|
+
* let e = hsl(.3, 1, .5); // green using hsl color
|
|
824
828
|
*/
|
|
825
829
|
export class Color {
|
|
826
830
|
/** Create a color with the rgba components passed in, white by default
|
|
@@ -952,7 +956,7 @@ declare module "littlejs.esm" {
|
|
|
952
956
|
*/
|
|
953
957
|
export function vec2(x?: (number | Vector2), y?: number): Vector2;
|
|
954
958
|
/**
|
|
955
|
-
* Create a color object with RGBA values
|
|
959
|
+
* Create a color object with RGBA values, white by default
|
|
956
960
|
* @param {Number} [r=1] - red
|
|
957
961
|
* @param {Number} [g=1] - green
|
|
958
962
|
* @param {Number} [b=1] - blue
|
|
@@ -962,7 +966,7 @@ declare module "littlejs.esm" {
|
|
|
962
966
|
*/
|
|
963
967
|
export function rgb(r?: number, g?: number, b?: number, a?: number): Color;
|
|
964
968
|
/**
|
|
965
|
-
* Create a color object with HSLA values
|
|
969
|
+
* Create a color object with HSLA values, white by default
|
|
966
970
|
* @param {Number} [h=0] - hue
|
|
967
971
|
* @param {Number} [s=0] - saturation
|
|
968
972
|
* @param {Number} [l=1] - lightness
|
|
@@ -1374,7 +1378,7 @@ declare module "littlejs.esm" {
|
|
|
1374
1378
|
* @namespace Audio
|
|
1375
1379
|
*/
|
|
1376
1380
|
/**
|
|
1377
|
-
* Sound Object - Stores a
|
|
1381
|
+
* Sound Object - Stores a sound for later use and can be played positionally
|
|
1378
1382
|
*
|
|
1379
1383
|
* <a href=https://killedbyapixel.github.io/ZzFX/>Create sounds using the ZzFX Sound Designer.</a>
|
|
1380
1384
|
* @example
|
|
@@ -1388,7 +1392,7 @@ declare module "littlejs.esm" {
|
|
|
1388
1392
|
/** Create a sound object and cache the zzfx samples for later use
|
|
1389
1393
|
* @param {Array} zzfxSound - Array of zzfx parameters, ex. [.5,.5]
|
|
1390
1394
|
* @param {Number} [range=soundDefaultRange] - World space max range of sound, will not play if camera is farther away
|
|
1391
|
-
* @param {Number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1395
|
+
* @param {Number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering
|
|
1392
1396
|
*/
|
|
1393
1397
|
constructor(zzfxSound: any[], range?: number, taper?: number);
|
|
1394
1398
|
/** @property {Number} - World space max range of sound, will not play if camera is farther away */
|
|
@@ -1489,18 +1493,18 @@ declare module "littlejs.esm" {
|
|
|
1489
1493
|
sampleChannels: any[];
|
|
1490
1494
|
/** Play the music
|
|
1491
1495
|
* @param {Number} [volume=1] - How much to scale volume by
|
|
1492
|
-
* @param {Boolean} [loop
|
|
1496
|
+
* @param {Boolean} [loop] - True if the music should loop
|
|
1493
1497
|
* @return {AudioBufferSourceNode} - The audio source node
|
|
1494
1498
|
*/
|
|
1495
1499
|
playMusic(volume?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1496
1500
|
}
|
|
1497
1501
|
/** Play an mp3, ogg, or wav audio from a local file or url
|
|
1498
|
-
* @param {String}
|
|
1502
|
+
* @param {String} filename - Location of sound file to play
|
|
1499
1503
|
* @param {Number} [volume] - How much to scale volume by
|
|
1500
1504
|
* @param {Boolean} [loop] - True if the music should loop
|
|
1501
1505
|
* @return {HTMLAudioElement} - The audio element for this sound
|
|
1502
1506
|
* @memberof Audio */
|
|
1503
|
-
export function playAudioFile(
|
|
1507
|
+
export function playAudioFile(filename: string, volume?: number, loop?: boolean): HTMLAudioElement;
|
|
1504
1508
|
/** Speak text with passed in settings
|
|
1505
1509
|
* @param {String} text - The text to speak
|
|
1506
1510
|
* @param {String} [language] - The language/accent to use (examples: en, it, ru, ja, zh)
|
|
@@ -1520,8 +1524,9 @@ declare module "littlejs.esm" {
|
|
|
1520
1524
|
* @memberof Audio */
|
|
1521
1525
|
export function getNoteFrequency(semitoneOffset: number, rootFrequency?: number): number;
|
|
1522
1526
|
/** Audio context used by the engine
|
|
1527
|
+
* @type {AudioContext}
|
|
1523
1528
|
* @memberof Audio */
|
|
1524
|
-
export let audioContext:
|
|
1529
|
+
export let audioContext: AudioContext;
|
|
1525
1530
|
/** Play cached audio samples with given settings
|
|
1526
1531
|
* @param {Array} sampleChannels - Array of arrays of samples to play (for stereo playback)
|
|
1527
1532
|
* @param {Number} [volume] - How much to scale volume by
|
|
@@ -1548,7 +1553,7 @@ declare module "littlejs.esm" {
|
|
|
1548
1553
|
* - Automatically adds self to object list
|
|
1549
1554
|
* - Will be updated and rendered each frame
|
|
1550
1555
|
* - Renders as a sprite from a tilesheet by default
|
|
1551
|
-
* - Can have color and
|
|
1556
|
+
* - Can have color and additive color applied
|
|
1552
1557
|
* - 2D Physics and collision system
|
|
1553
1558
|
* - Sorted by renderOrder
|
|
1554
1559
|
* - Objects can have children attached
|
|
@@ -1682,7 +1687,7 @@ declare module "littlejs.esm" {
|
|
|
1682
1687
|
/**
|
|
1683
1688
|
* LittleJS Tile Layer System
|
|
1684
1689
|
* - Caches arrays of tiles to off screen canvas for fast rendering
|
|
1685
|
-
* -
|
|
1690
|
+
* - Unlimited numbers of layers, allocates canvases as needed
|
|
1686
1691
|
* - Interfaces with EngineObject for collision
|
|
1687
1692
|
* - Collision layer is separate from visible layers
|
|
1688
1693
|
* - It is recommended to have a visible layer that matches the collision
|
|
@@ -1714,7 +1719,7 @@ declare module "littlejs.esm" {
|
|
|
1714
1719
|
export function getTileCollisionData(pos: Vector2): number;
|
|
1715
1720
|
/** Check if collision with another object should occur
|
|
1716
1721
|
* @param {Vector2} pos
|
|
1717
|
-
* @param {Vector2} [size=(
|
|
1722
|
+
* @param {Vector2} [size=(0,0)]
|
|
1718
1723
|
* @param {EngineObject} [object]
|
|
1719
1724
|
* @return {Boolean}
|
|
1720
1725
|
* @memberof TileCollision */
|
|
@@ -1842,12 +1847,12 @@ declare module "littlejs.esm" {
|
|
|
1842
1847
|
* @example
|
|
1843
1848
|
* // create a particle emitter
|
|
1844
1849
|
* let pos = vec2(2,3);
|
|
1845
|
-
* let
|
|
1850
|
+
* let particleEmitter = new ParticleEmitter
|
|
1846
1851
|
* (
|
|
1847
|
-
* pos, 0, 1, 0, 500, PI,
|
|
1848
|
-
* tile(0, 16),
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1852
|
+
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
|
|
1853
|
+
* tile(0, 16), // tileInfo
|
|
1854
|
+
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
|
|
1855
|
+
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
|
|
1851
1856
|
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
|
|
1852
1857
|
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
|
|
1853
1858
|
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
|