littlejsengine 1.10.2 → 1.10.7
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 +15 -93
- package/dist/littlejs.d.ts +79 -17
- package/dist/littlejs.esm.js +179 -90
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +165 -90
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +165 -90
- package/examples/box2d/game.js +15 -1
- package/examples/box2d/gameObjects.js +10 -9
- package/examples/box2d/index.html +5 -5
- package/examples/box2d/scenes.js +4 -4
- package/examples/box2d/tiles.png +0 -0
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/README.md +9 -7
- package/examples/breakoutTutorial/game.js +6 -6
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/game.js +3 -0
- package/examples/electron/index.html +2 -2
- package/examples/htmlMenu/index.html +3 -3
- package/examples/js13k/game.js +3 -0
- package/examples/js13k/index.html +13 -13
- package/examples/module/game.js +3 -0
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +4 -1
- package/examples/platformer/game.js +21 -15
- package/examples/platformer/gameCharacter.js +15 -14
- package/examples/platformer/gameEffects.js +3 -4
- package/examples/platformer/gameLevel.js +18 -33
- package/examples/platformer/gameObjects.js +9 -14
- package/examples/platformer/index.html +8 -8
- package/examples/platformer/tiles.png +0 -0
- package/examples/puzzle/index.html +2 -2
- package/examples/starter/game.js +3 -0
- package/examples/starter/index.html +13 -13
- package/examples/stress/index.html +1 -1
- package/examples/typescript/game.js +2 -0
- package/examples/typescript/game.ts +4 -1
- package/examples/typescript/index.html +1 -1
- package/examples/uiSystem/game.js +23 -16
- package/examples/uiSystem/index.html +3 -14
- package/package.json +1 -1
- package/plugins/postProcess.js +1 -1
- package/plugins/uiSystem.js +84 -24
- package/src/engine.js +14 -22
- package/src/engineAudio.js +7 -13
- package/src/engineDraw.js +20 -19
- package/src/engineExport.js +14 -0
- package/src/engineInput.js +8 -6
- package/src/engineMedals.js +19 -5
- package/src/engineObject.js +9 -5
- package/src/engineTileLayer.js +10 -8
- package/src/engineUtilities.js +60 -10
- package/src/engineWebGL.js +17 -2
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
## 🚂 All aboard!
|
|
16
16
|
|
|
17
|
-
LittleJS is a fast lightweight open source HTML5 game engine for
|
|
18
|
-
Its small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound
|
|
19
|
-
The code is
|
|
17
|
+
LittleJS is a fast, lightweight, and fully open source HTML5 game engine designed for simplicity and performance.
|
|
18
|
+
Its small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound, and input handling.
|
|
19
|
+
The code is clean and well documented with some fun examples to get you started right away. Choo-Choo!
|
|
20
20
|
|
|
21
21
|
### 🚀 Join the First Ever LittleJS Game Jam
|
|
22
22
|
|
|
@@ -24,13 +24,13 @@ 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) | [FAQ](https://github.com/KilledByAPixel/LittleJS/blob/main/FAQ.md)
|
|
28
28
|
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|

|
|
32
32
|
|
|
33
|
-
## About LittleJS
|
|
33
|
+
## About LittleJS Engine
|
|
34
34
|
|
|
35
35
|
LittleJS is a small but powerful game engine with many features and no dependencies.
|
|
36
36
|
|
|
@@ -43,7 +43,7 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
43
43
|
|
|
44
44
|
### 🔊 Audio
|
|
45
45
|
|
|
46
|
-
- Positional sound effects with wave files or ZzFX
|
|
46
|
+
- Positional sound effects with wave files, mp3s, or ZzFX
|
|
47
47
|
- Use [ZzFX](https://killedbyapixel.github.io/ZzFX/) sound effect generator to play sounds without asset files
|
|
48
48
|
- Music with mp3, ogg, wave, or [ZzFXM](https://keithclark.github.io/ZzFXM/)
|
|
49
49
|
|
|
@@ -83,13 +83,11 @@ To get started download the latest LittleJS package from GitHub or install via n
|
|
|
83
83
|
|
|
84
84
|
This is because web browsers just have protection from loading local files. You may see a console error like "The image element contains cross-origin data." Don't panic, it's easy to fix! If you are using [Visual Studio Code](https://code.visualstudio.com/) there is a [Live Preview Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.live-server) that will handle this for you automatically. Another option is to setup a simple local web server like [http-server](https://www.npmjs.com/package/http-server) via npm.
|
|
85
85
|
|
|
86
|
-
Learn how to make a simple game from scratch with [The Breakout Tutorial.](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial)
|
|
87
|
-
|
|
88
|
-
[
|
|
89
|
-
|
|
90
|
-
[
|
|
91
|
-
|
|
92
|
-
Join our vibrant community on [Discord](https://discord.gg/zb7hcGkyZe) to get help, share your projects, and collaborate with others!
|
|
86
|
+
- Learn how to make a simple game from scratch with [The Breakout Tutorial.](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial)
|
|
87
|
+
- [LittleJS Engine Quick Reference Sheet](https://github.com/KilledByAPixel/LittleJS/blob/main/reference.md) - This cheat sheet can help you get started.
|
|
88
|
+
- [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.
|
|
89
|
+
- Join our vibrant community on [Discord](https://discord.gg/zb7hcGkyZe) to get help, share your projects, and collaborate with others!
|
|
90
|
+
- [Check out The Little JS FAQ for more help getting started](https://github.com/KilledByAPixel/LittleJS/blob/main/FAQ.md), and let us know if there's anything you'd like to see added.
|
|
93
91
|
|
|
94
92
|
## Examples
|
|
95
93
|
|
|
@@ -102,6 +100,7 @@ These demos are for both learning and using as starter projects to create your o
|
|
|
102
100
|
- [Box2D Demo](https://killedbyapixel.github.io/LittleJS/examples/box2d/) - Box2D plugin demonstration and testbed
|
|
103
101
|
- [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress/) - Max sprite/object test and music system demo
|
|
104
102
|
- [Particle System Designer](https://killedbyapixel.github.io/LittleJS/examples/particles/) - Particle system editor and visualizer
|
|
103
|
+
- [All Examples](https://killedbyapixel.github.io/LittleJS/examples/) - Links to all the example projects on one page
|
|
105
104
|
|
|
106
105
|
## Builds
|
|
107
106
|
|
|
@@ -117,93 +116,18 @@ To rebuild the engine you must first run ```npm install``` to setup the necessar
|
|
|
117
116
|
|
|
118
117
|
The starter example project 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.
|
|
119
118
|
|
|
120
|
-
## LittleJS Setup
|
|
121
|
-
|
|
122
|
-
To start LittleJS, you need to create these 5 functions and pass them to engineInit.
|
|
123
|
-
|
|
124
|
-
```javascript
|
|
125
|
-
function gameInit()
|
|
126
|
-
{
|
|
127
|
-
// called once after the engine starts up
|
|
128
|
-
// setup the game
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function gameUpdate()
|
|
132
|
-
{
|
|
133
|
-
// called every frame at 60 frames per second
|
|
134
|
-
// handle input and update the game state
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function gameUpdatePost()
|
|
138
|
-
{
|
|
139
|
-
// called after physics and objects are updated
|
|
140
|
-
// setup camera and prepare for render
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function gameRender()
|
|
144
|
-
{
|
|
145
|
-
// called before objects are rendered
|
|
146
|
-
// draw any background effects that appear behind objects
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function gameRenderPost()
|
|
150
|
-
{
|
|
151
|
-
// called after objects are rendered
|
|
152
|
-
// draw effects or hud that appear above all objects
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Startup LittleJS Engine
|
|
156
|
-
engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost);
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## LittleJS Objects
|
|
160
|
-
|
|
161
|
-
LittleJS can be used as an object oriented system by extending the base class [EngineObject](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineObject.js) with your own. This lightweight class provides many useful features including physics, collision, parent/child system, and sorted rendering. These objects are added to the global list of objects where they will automatically be updated and rendered until destroyed.
|
|
162
|
-
|
|
163
|
-
Here is a template you can use to make objects that behave however you want. See the examples for a complete demonstration.
|
|
164
|
-
|
|
165
|
-
```javascript
|
|
166
|
-
class MyObject extends EngineObject
|
|
167
|
-
{
|
|
168
|
-
constructor(pos, size, tileInfo, angle)
|
|
169
|
-
{
|
|
170
|
-
super(pos, size, tileInfo, angle);
|
|
171
|
-
// setup object
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
update()
|
|
175
|
-
{
|
|
176
|
-
// update object physics and position
|
|
177
|
-
super.update();
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
render()
|
|
181
|
-
{
|
|
182
|
-
// draw object as a sprite
|
|
183
|
-
super.render();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Debugging
|
|
189
|
-
|
|
190
119
|
Debug builds of LittleJS have a special menu that can be opened by pressing the Esc key.
|
|
191
120
|
|
|
192
|
-
- Esc: Debug Overlay
|
|
193
|
-
- 1: Debug Physics
|
|
194
|
-
- 2: Debug Particles
|
|
195
|
-
- 3: Debug Gamepads
|
|
196
|
-
- 4: Debug Raycasts
|
|
197
|
-
- 5: Save Screenshot
|
|
198
|
-
|
|
199
121
|
## Games Made With LittleJS
|
|
200
122
|
|
|
201
123
|
Here are a few of the amazing games people made using LittleJS...
|
|
202
124
|
|
|
203
125
|
- [Space Huggers](https://github.com/KilledByAPixel/SpaceHuggers) - Original js13k game with source code by [KilledByAPixel](https://frankforce.com/)
|
|
204
126
|
- [Undergrowth](https://undergrowth.squidband.uk/) - An interactive music videogame for the band Squid by [KilledByAPixel](https://frankforce.com/)
|
|
205
|
-
- [
|
|
127
|
+
- [The Way of the Dodo](https://js13kgames.com/2024/games/the-way-of-the-dodo) - Single button platformer by [repsej](https://github.com/repsej)
|
|
128
|
+
- [Wendol Village](https://js13kgames.com/2024/games/wendol-village) - Warcraft-like RTS game by [sanojian](https://github.com/sanojian)
|
|
206
129
|
- [Dead Again](https://js13kgames.com/entries/dead-again) - Top down survial horror by [sanojian & repsej](https://github.com/sanojian/js13k_2022)
|
|
130
|
+
- [Isletopia](https://store.steampowered.com/app/1861260/Isletopia) - Relaxing strategy game of greenifying barren islands by [Gamex Studio](https://x.com/gamesgamex)
|
|
207
131
|
- [Hel's Trial](https://js13kgames.com/entries/hels-trial) - Turn based RPG by [Sebastian Dorn](https://github.com/sebadorn/js13k-2022-death)
|
|
208
132
|
- [Bit Butcher](https://js13kgames.com/entries/bit-butcher) - Survival crafting game by [Deathray Games](https://github.com/deathraygames/bit-butcher)
|
|
209
133
|
- [Necrotic Commander](https://js13kgames.com/entries/necrotic-commander) - Tower defense game by [Daniel Jeffery](https://github.com/d-jeffery/NecroticCommander)
|
|
@@ -212,8 +136,6 @@ Here are a few of the amazing games people made using LittleJS...
|
|
|
212
136
|
- [brrr!](https://snowfrog.itch.io/brrr) - Base defense and shooting game by [Snowfrog](https://www.snowfrog.dev/)
|
|
213
137
|
- [Wands of Triskaidekai](https://js13kgames.com/2024/games/wands-of-triskaidekai) - Platformer with experimental gameplay by [gregwoodsfrontier](https://github.com/gregwoodsfrontier)
|
|
214
138
|
- [Data Warrior: 13kb limit](https://js13kgames.com/2024/games/data-warrior-13kb-limit) - Vampire Survivors-like game by [rndD](https://github.com/rndD)
|
|
215
|
-
- [The Way of the Dodo](https://js13kgames.com/2024/games/the-way-of-the-dodo) - Single button platformer by [repsej](https://github.com/repsej)
|
|
216
|
-
- [Wendol Village](https://js13kgames.com/2024/games/wendol-village) - Warcraft-like RTS game by [sanojian](https://github.com/sanojian)
|
|
217
139
|
- [Unblock](https://js13kgames.com/games/unblock) - Retro style space shooter by [Isaac Benitez](https://github.com/isacben)
|
|
218
140
|
|
|
219
141
|

|
package/dist/littlejs.d.ts
CHANGED
|
@@ -64,15 +64,15 @@ declare module "littlejsengine" {
|
|
|
64
64
|
* @memberof Engine */
|
|
65
65
|
export function setPaused(isPaused: boolean): void;
|
|
66
66
|
/** Startup LittleJS engine with your callback functions
|
|
67
|
-
* @param {Function} gameInit
|
|
68
|
-
* @param {Function} gameUpdate
|
|
69
|
-
* @param {Function} gameUpdatePost - Called after physics and objects are updated,
|
|
70
|
-
* @param {Function} gameRender
|
|
71
|
-
* @param {Function} gameRenderPost - Called after objects are rendered,
|
|
72
|
-
* @param {Array} [imageSources=[
|
|
67
|
+
* @param {Function|function():Promise} gameInit - Called once after the engine starts up
|
|
68
|
+
* @param {Function} gameUpdate - Called every frame before objects are updated
|
|
69
|
+
* @param {Function} gameUpdatePost - Called after physics and objects are updated, even when paused
|
|
70
|
+
* @param {Function} gameRender - Called before objects are rendered, for drawing the background
|
|
71
|
+
* @param {Function} gameRenderPost - Called after objects are rendered, useful for drawing UI
|
|
72
|
+
* @param {Array} [imageSources=[]] - List of images to load
|
|
73
73
|
* @param {HTMLElement} [rootElement] - Root element to attach to, the document body by default
|
|
74
74
|
* @memberof Engine */
|
|
75
|
-
export function engineInit(gameInit: Function, gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: any[], rootElement?: HTMLElement): void;
|
|
75
|
+
export function engineInit(gameInit: Function | (() => Promise<any>), gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, imageSources?: any[], rootElement?: HTMLElement): void;
|
|
76
76
|
/** Update each engine object, remove destroyed objects, and update time
|
|
77
77
|
* @memberof Engine */
|
|
78
78
|
export function engineObjectsUpdate(): void;
|
|
@@ -700,7 +700,8 @@ declare module "littlejsengine" {
|
|
|
700
700
|
* @return {Number}
|
|
701
701
|
* @memberof Random */
|
|
702
702
|
export function rand(valueA?: number, valueB?: number): number;
|
|
703
|
-
/** Returns a floored random value the two values passed in
|
|
703
|
+
/** Returns a floored random value between the two values passed in
|
|
704
|
+
* The upper bound is exclusive. (If 2 is passed in, result will be 0 or 1)
|
|
704
705
|
* @param {Number} valueA
|
|
705
706
|
* @param {Number} [valueB]
|
|
706
707
|
* @return {Number}
|
|
@@ -875,6 +876,9 @@ declare module "littlejsengine" {
|
|
|
875
876
|
* @param {Number} digits - precision to display
|
|
876
877
|
* @return {String} */
|
|
877
878
|
toString(digits?: number): string;
|
|
879
|
+
/** Checks if this is a valid vector
|
|
880
|
+
* @return {Boolean} */
|
|
881
|
+
isValid(): boolean;
|
|
878
882
|
}
|
|
879
883
|
/**
|
|
880
884
|
* Color object (red, green, blue, alpha) with some helpful functions
|
|
@@ -965,6 +969,9 @@ declare module "littlejsengine" {
|
|
|
965
969
|
/** Returns this color expressed as 32 bit RGBA value
|
|
966
970
|
* @return {Number} */
|
|
967
971
|
rgbaInt(): number;
|
|
972
|
+
/** Checks if this is a valid color
|
|
973
|
+
* @return {Boolean} */
|
|
974
|
+
isValid(): boolean;
|
|
968
975
|
}
|
|
969
976
|
/**
|
|
970
977
|
* Timer object tracks how long has passed since it was set
|
|
@@ -1109,7 +1116,7 @@ declare module "littlejsengine" {
|
|
|
1109
1116
|
* tile(2) // a tile at index 2 using the default tile size of 16
|
|
1110
1117
|
* tile(5, 8) // a tile at index 5 using a tile size of 8
|
|
1111
1118
|
* tile(1, 16, 3) // a tile at index 1 of size 16 on texture 3
|
|
1112
|
-
* tile(vec2(4,8), vec2(30,10)) // a tile at
|
|
1119
|
+
* tile(vec2(4,8), vec2(30,10)) // a tile at index (4,8) with a size of (30,10)
|
|
1113
1120
|
* @memberof Draw
|
|
1114
1121
|
*/
|
|
1115
1122
|
export function tile(pos?: (number | Vector2), size?: (number | Vector2), textureIndex?: number, padding?: number): TileInfo;
|
|
@@ -1245,6 +1252,37 @@ declare module "littlejsengine" {
|
|
|
1245
1252
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1246
1253
|
* @memberof Draw */
|
|
1247
1254
|
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1255
|
+
/** Draw colored polygon using passed in points
|
|
1256
|
+
* @param {Array} points - Array of Vector2 points
|
|
1257
|
+
* @param {Color} [color=(1,1,1,1)]
|
|
1258
|
+
* @param {Number} [lineWidth=0]
|
|
1259
|
+
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1260
|
+
* @param {Boolean} [screenSpace=false]
|
|
1261
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1262
|
+
* @memberof Draw */
|
|
1263
|
+
export function drawPoly(points: any[], color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1264
|
+
/** Draw colored ellipse using passed in point
|
|
1265
|
+
* @param {Vector2} pos
|
|
1266
|
+
* @param {Number} [width=1]
|
|
1267
|
+
* @param {Number} [height=1]
|
|
1268
|
+
* @param {Number} [angle=0]
|
|
1269
|
+
* @param {Color} [color=(1,1,1,1)]
|
|
1270
|
+
* @param {Number} [lineWidth=0]
|
|
1271
|
+
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1272
|
+
* @param {Boolean} [screenSpace=false]
|
|
1273
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1274
|
+
* @memberof Draw */
|
|
1275
|
+
export function drawEllipse(pos: Vector2, width?: number, height?: number, angle?: number, color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1276
|
+
/** Draw colored circle using passed in point
|
|
1277
|
+
* @param {Vector2} pos
|
|
1278
|
+
* @param {Number} [radius=1]
|
|
1279
|
+
* @param {Color} [color=(1,1,1,1)]
|
|
1280
|
+
* @param {Number} [lineWidth=0]
|
|
1281
|
+
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1282
|
+
* @param {Boolean} [screenSpace=false]
|
|
1283
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1284
|
+
* @memberof Draw */
|
|
1285
|
+
export function drawCircle(pos: Vector2, radius?: number, color?: Color, lineWidth?: number, lineColor?: Color, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1248
1286
|
/** Draw directly to a 2d canvas context in world space
|
|
1249
1287
|
* @param {Vector2} pos
|
|
1250
1288
|
* @param {Vector2} size
|
|
@@ -1403,6 +1441,23 @@ declare module "littlejsengine" {
|
|
|
1403
1441
|
* @param {WebGLTexture} texture
|
|
1404
1442
|
* @memberof WebGL */
|
|
1405
1443
|
export function glSetTexture(texture: WebGLTexture): void;
|
|
1444
|
+
/** Set antialiasing for webgl canvas
|
|
1445
|
+
* @param {Boolean} [antialias]
|
|
1446
|
+
* @memberof WebGL */
|
|
1447
|
+
export function glSetAntialias(antialias?: boolean): void;
|
|
1448
|
+
/** Shoule webgl be setup with antialiasing, must be set before calling engineInit
|
|
1449
|
+
* @type {Boolean}
|
|
1450
|
+
* @memberof WebGL */
|
|
1451
|
+
export let glAntialias: boolean;
|
|
1452
|
+
export let glShader: any;
|
|
1453
|
+
export let glActiveTexture: any;
|
|
1454
|
+
export let glArrayBuffer: any;
|
|
1455
|
+
export let glGeometryBuffer: any;
|
|
1456
|
+
export let glPositionData: any;
|
|
1457
|
+
export let glColorData: any;
|
|
1458
|
+
export let glInstanceCount: any;
|
|
1459
|
+
export let glAdditive: any;
|
|
1460
|
+
export let glBatchAdditive: any;
|
|
1406
1461
|
/**
|
|
1407
1462
|
* LittleJS Input System
|
|
1408
1463
|
* - Tracks keyboard down, pressed, and released
|
|
@@ -1540,6 +1595,8 @@ declare module "littlejsengine" {
|
|
|
1540
1595
|
taper: number;
|
|
1541
1596
|
/** @property {Number} - How much to randomize frequency each time sound plays */
|
|
1542
1597
|
randomness: any;
|
|
1598
|
+
/** @property {GainNode} - Gain node for this sound */
|
|
1599
|
+
gainNode: GainNode;
|
|
1543
1600
|
sampleChannels: any[][];
|
|
1544
1601
|
sampleRate: number;
|
|
1545
1602
|
/** Play the sound
|
|
@@ -1551,7 +1608,6 @@ declare module "littlejsengine" {
|
|
|
1551
1608
|
* @return {AudioBufferSourceNode} - The audio source node
|
|
1552
1609
|
*/
|
|
1553
1610
|
play(pos?: Vector2, volume?: number, pitch?: number, randomnessScale?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1554
|
-
gainNode: GainNode;
|
|
1555
1611
|
source: AudioBufferSourceNode;
|
|
1556
1612
|
/** Set the sound volume
|
|
1557
1613
|
* @param {Number} [volume] - How much to scale volume by
|
|
@@ -1866,24 +1922,24 @@ declare module "littlejsengine" {
|
|
|
1866
1922
|
* - Drawn directly to the main canvas without using WebGL
|
|
1867
1923
|
* @namespace TileCollision
|
|
1868
1924
|
*/
|
|
1869
|
-
/** The tile collision layer
|
|
1925
|
+
/** The tile collision layer grid, use setTileCollisionData and getTileCollisionData to access
|
|
1870
1926
|
* @type {Array}
|
|
1871
1927
|
* @memberof TileCollision */
|
|
1872
1928
|
export let tileCollision: any[];
|
|
1873
|
-
/** Size of the tile collision layer
|
|
1929
|
+
/** Size of the tile collision layer 2d grid
|
|
1874
1930
|
* @type {Vector2}
|
|
1875
1931
|
* @memberof TileCollision */
|
|
1876
1932
|
export let tileCollisionSize: Vector2;
|
|
1877
1933
|
/** Clear and initialize tile collision
|
|
1878
|
-
* @param {Vector2} size
|
|
1934
|
+
* @param {Vector2} size - width and height of tile collision 2d grid
|
|
1879
1935
|
* @memberof TileCollision */
|
|
1880
1936
|
export function initTileCollision(size: Vector2): void;
|
|
1881
|
-
/** Set tile collision data
|
|
1937
|
+
/** Set tile collision data for a given cell in the grid
|
|
1882
1938
|
* @param {Vector2} pos
|
|
1883
1939
|
* @param {Number} [data]
|
|
1884
1940
|
* @memberof TileCollision */
|
|
1885
1941
|
export function setTileCollisionData(pos: Vector2, data?: number): void;
|
|
1886
|
-
/** Get tile collision data
|
|
1942
|
+
/** Get tile collision data for a given cell in the grid
|
|
1887
1943
|
* @param {Vector2} pos
|
|
1888
1944
|
* @return {Number}
|
|
1889
1945
|
* @memberof TileCollision */
|
|
@@ -1895,7 +1951,8 @@ declare module "littlejsengine" {
|
|
|
1895
1951
|
* @return {Boolean}
|
|
1896
1952
|
* @memberof TileCollision */
|
|
1897
1953
|
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
|
|
1898
|
-
/** Return the center of first tile hit
|
|
1954
|
+
/** Return the center of first tile hit, undefined if nothing was hit.
|
|
1955
|
+
* This does not return the exact intersection, but the center of the tile hit.
|
|
1899
1956
|
* @param {Vector2} posStart
|
|
1900
1957
|
* @param {Vector2} posEnd
|
|
1901
1958
|
* @param {EngineObject} [object]
|
|
@@ -2197,14 +2254,19 @@ declare module "littlejsengine" {
|
|
|
2197
2254
|
* @param {String} [src] - Image location for the medal
|
|
2198
2255
|
*/
|
|
2199
2256
|
constructor(id: number, name: string, description?: string, icon?: string, src?: string);
|
|
2257
|
+
/** @property {Number} - The unique identifier of the medal */
|
|
2200
2258
|
id: number;
|
|
2259
|
+
/** @property {String} - Name of the medal */
|
|
2201
2260
|
name: string;
|
|
2261
|
+
/** @property {String} - Description of the medal */
|
|
2202
2262
|
description: string;
|
|
2263
|
+
/** @property {String} - Icon for the medal */
|
|
2203
2264
|
icon: string;
|
|
2265
|
+
/** @property {Boolean} - Is the medal unlocked? */
|
|
2266
|
+
unlocked: boolean;
|
|
2204
2267
|
image: HTMLImageElement;
|
|
2205
2268
|
/** Unlocks a medal if not already unlocked */
|
|
2206
2269
|
unlock(): void;
|
|
2207
|
-
unlocked: number;
|
|
2208
2270
|
/** Render a medal
|
|
2209
2271
|
* @param {Number} [hidePercent] - How much to slide the medal off screen
|
|
2210
2272
|
*/
|