littlejsengine 1.11.2 → 1.11.5
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/.vscode/launch.json +14 -0
- package/README.md +16 -18
- package/dist/littlejs.d.ts +41 -30
- package/dist/littlejs.esm.js +165 -143
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +161 -142
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +157 -135
- package/examples/box2d/gameObjects.js +4 -4
- package/examples/box2d/scenes.js +2 -2
- package/examples/breakout/game.js +1 -1
- package/examples/breakout/gameObjects.js +28 -29
- package/examples/breakout/index.html +1 -1
- package/examples/breakoutTutorial/game.js +1 -1
- package/examples/index.html +1 -7
- package/examples/logo.png +0 -0
- package/examples/module/game.js +1 -1
- package/examples/platformer/game.js +2 -2
- package/examples/platformer/gameCharacter.js +5 -5
- package/examples/platformer/gameEffects.js +4 -4
- package/examples/platformer/gameObjects.js +2 -2
- package/examples/puzzle/game.js +3 -3
- package/examples/starter/game.js +11 -45
- package/examples/starter/tiles.png +0 -0
- package/jsconfig.json +1 -0
- package/package.json +1 -1
- package/plugins/box2d.js +10 -10
- package/plugins/newgrounds.js +1 -1
- package/plugins/postProcess.js +8 -8
- package/shortExamples/base.html +36 -0
- package/shortExamples/code/blending.js +12 -0
- package/shortExamples/code/helloWorld.js +7 -0
- package/shortExamples/code/particles.js +28 -0
- package/shortExamples/code/playSound.js +36 -0
- package/shortExamples/code/pong.js +40 -0
- package/shortExamples/code/shapes.js +24 -0
- package/shortExamples/code/spriteAtlas.js +27 -0
- package/shortExamples/code/systemFont.js +14 -0
- package/shortExamples/code/texture.js +12 -0
- package/shortExamples/code/tileLayer.js +50 -0
- package/shortExamples/index.html +242 -0
- package/shortExamples/tiles.png +0 -0
- package/src/engine.js +17 -3
- package/src/engineAudio.js +4 -4
- package/src/engineBuild.js +2 -1
- package/src/engineDebug.js +4 -7
- package/src/engineDraw.js +50 -25
- package/src/engineExport.js +4 -1
- package/src/engineInput.js +1 -1
- package/src/engineObject.js +8 -8
- package/src/engineParticles.js +7 -7
- package/src/engineSettings.js +5 -5
- package/src/engineTileLayer.js +6 -2
- package/src/engineUtilities.js +5 -5
- package/src/engineWebGL.js +52 -74
- package/examples/electron/build.js +0 -107
- package/examples/electron/electron.js +0 -43
- package/examples/electron/game.js +0 -131
- package/examples/electron/index.html +0 -13
- package/examples/electron/package.json +0 -22
- package/examples/electron/tiles.png +0 -0
- package/examples/js13k/build.bat +0 -2
- package/examples/js13k/build.js +0 -131
- package/examples/js13k/game.js +0 -118
- package/examples/js13k/index.html +0 -21
- package/examples/js13k/tiles.png +0 -0
- package/examples/typescript/build.bat +0 -5
- package/examples/typescript/build.js +0 -33
- package/examples/typescript/game.js +0 -102
- package/examples/typescript/game.ts +0 -134
- package/examples/typescript/index.html +0 -10
- package/examples/typescript/tiles.png +0 -0
- package/examples/typescript/tsconfig.json +0 -8
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "chrome",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Open index.html",
|
|
11
|
+
"file": "c:\\dev\\FrankGames\\html5\\LittleJS\\LittleJS\\shortExamples\\index.html"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ LittleJS is a fast, lightweight, and fully open source HTML5 game engine designe
|
|
|
18
18
|
Its small footprint is packed with a comprehensive feature set including hybrid rendering, physics, particles, sound, and input handling.
|
|
19
19
|
The code is clean and well documented with some fun examples to get you started right away. Choo-Choo!
|
|
20
20
|
|
|
21
|
-
### 🚀 Join the
|
|
21
|
+
### 🚀 Join the Second Annual LittleJS Game Jam
|
|
22
22
|
|
|
23
|
-
*The LittleJS Game Jam will take place From
|
|
23
|
+
*The LittleJS Game Jam will take place From Oct 3 to Nov 3! Unleash your creativity and develop amazing games using the LittleJS game engine. 🕹️🎮 [Sign up today and get more info about the jam on itch.io!](https://itch.io/jam/littlejs-game-jam-2025)*
|
|
24
24
|
|
|
25
25
|
<div align="center">
|
|
26
26
|
|
|
@@ -62,7 +62,7 @@ LittleJS is a small but powerful game engine with many features and no dependenc
|
|
|
62
62
|
|
|
63
63
|
- Compatible with all modern web browsers and on mobile devices
|
|
64
64
|
- Support for TypeScript and Modules with example projects for both
|
|
65
|
-
- Ideal for size coding competitions like [js13kGames](https://js13kgames.com/), [starter project builds to a 7KB zip](https://
|
|
65
|
+
- Ideal for size coding competitions like [js13kGames](https://js13kgames.com/), [starter project builds to a 7KB zip](https://github.com/KilledByAPixel/LittleJS/tree/js13k)
|
|
66
66
|
- Builds to an executable with [Electron](https://www.electronjs.org/) for distribution on Windows, macOS, and Linux
|
|
67
67
|
- Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want forever
|
|
68
68
|
|
|
@@ -84,6 +84,7 @@ To get started download the latest LittleJS package from GitHub or install via n
|
|
|
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
86
|
- Learn how to make a simple game from scratch with [The Breakout Tutorial.](https://github.com/KilledByAPixel/LittleJS/tree/main/examples/breakoutTutorial)
|
|
87
|
+
- [Make a ski game with LittleJS](https://eoinmcgrath.com/little-ski/tutorial.html) - Check out this tutorial by eoinmcg that shows how to make a pixel art style game.
|
|
87
88
|
- [LittleJS Engine Quick Reference Sheet](https://github.com/KilledByAPixel/LittleJS/blob/main/reference.md) - This cheat sheet can help you get started.
|
|
88
89
|
- [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
90
|
- Join our vibrant community on [Discord](https://discord.gg/zb7hcGkyZe) to get help, share your projects, and collaborate with others!
|
|
@@ -122,21 +123,18 @@ Debug builds of LittleJS have a special menu that can be opened by pressing the
|
|
|
122
123
|
|
|
123
124
|
Here are a few of the amazing games people made using LittleJS...
|
|
124
125
|
|
|
125
|
-
- [Space Huggers](https://
|
|
126
|
-
- [Undergrowth](https://undergrowth.squidband.uk/) - An interactive music videogame for the band Squid by [KilledByAPixel](https://frankforce.com/)
|
|
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
|
-
- [
|
|
129
|
-
- [
|
|
130
|
-
- [
|
|
131
|
-
- [
|
|
132
|
-
- [
|
|
133
|
-
- [
|
|
134
|
-
- [
|
|
135
|
-
- [
|
|
136
|
-
- [
|
|
137
|
-
- [Wands of Triskaidekai](https://js13kgames.com/2024/games/wands-of-triskaidekai) - Platformer with experimental gameplay by [gregwoodsfrontier](https://github.com/gregwoodsfrontier)
|
|
138
|
-
- [Data Warrior: 13kb limit](https://js13kgames.com/2024/games/data-warrior-13kb-limit) - Vampire Survivors-like game by [rndD](https://github.com/rndD)
|
|
139
|
-
- [Unblock](https://js13kgames.com/games/unblock) - Retro style space shooter by [Isaac Benitez](https://github.com/isacben)
|
|
126
|
+
- [Space Huggers](https://www.newgrounds.com/portal/view/819609) - Rogulike platformer shoot-em-up game with procedural levels. by [KilledByAPixel](https://frankforce.com/)
|
|
127
|
+
- [Undergrowth](https://undergrowth.squidband.uk/) - An interactive music videogame for the band Squid. by [KilledByAPixel](https://frankforce.com/)
|
|
128
|
+
- [The Way of the Dodo](https://js13kgames.com/2024/games/the-way-of-the-dodo) - Single button platformer. JS13k 5th place winner! by [repsej](https://github.com/repsej)
|
|
129
|
+
- [204Snake!](https://www.newgrounds.com/portal/view/960100) - A puzzle game that combines 2048 with snake. LittleJS Jam 1st place winner! by [Sodoj](https://sodoj.itch.io/) and [Shai-P](https://shai-p.itch.io/)
|
|
130
|
+
- [GATOR](https://www.newgrounds.com/portal/view/960757) - Retro platformer shooter game where you rescue animals. LittleJS Jam 2nd place winner! by [eoinmcg](https://eoinmcg.itch.io/)
|
|
131
|
+
- [A Hedgehog's search](https://willsm1111.itch.io/a-hedgehogs-search) - Adventure game staring a hedgehog. LittleJS Jam 3rd place winner! by [willsm1111](https://willsm1111.itch.io/)
|
|
132
|
+
- [Wendol Village](https://js13kgames.com/2024/games/wendol-village) - Warcraft inspired RTS game. by [sanojian](https://github.com/sanojian)
|
|
133
|
+
- [Dead Again](https://js13kgames.com/entries/dead-again) - Top down survial horror. by [sanojian & repsej](https://github.com/sanojian/js13k_2022)
|
|
134
|
+
- [Isletopia](https://store.steampowered.com/app/1861260/Isletopia) - Relaxing strategy game of greenifying barren islands. by [Gamex Studio](https://x.com/gamesgamex)
|
|
135
|
+
- [Tetrimals](https://nixn.itch.io/tetrimals) - A puzzle game mixing Tetris with animals. by [nixn](https://nixn.itch.io/)
|
|
136
|
+
- [Watch the Pups](https://ma5a.itch.io/watch-the-pups) - The aim of the game is to take care of some puppies. by [masa](https://ma5a.itch.io/)
|
|
137
|
+
- [LittleJS Game Jam Results](https://itch.io/jam/littlejs-game-jam/results) - Check out all the games from the first LittleJS Game Jam!
|
|
140
138
|
|
|
141
139
|

|
|
142
140
|
|
package/dist/littlejs.d.ts
CHANGED
|
@@ -272,7 +272,7 @@ declare module "littlejsengine" {
|
|
|
272
272
|
* @default
|
|
273
273
|
* @memberof Settings */
|
|
274
274
|
export let enablePhysicsSolver: boolean;
|
|
275
|
-
/** Default object mass for collision
|
|
275
|
+
/** Default object mass for collision calculations (how heavy objects are)
|
|
276
276
|
* @type {Number}
|
|
277
277
|
* @default
|
|
278
278
|
* @memberof Settings */
|
|
@@ -436,7 +436,7 @@ declare module "littlejsengine" {
|
|
|
436
436
|
* @param {Boolean} show
|
|
437
437
|
* @memberof Settings */
|
|
438
438
|
export function setShowSplashScreen(show: boolean): void;
|
|
439
|
-
/** Set to
|
|
439
|
+
/** Set to disable rendering, audio, and input for servers
|
|
440
440
|
* @param {Boolean} headless
|
|
441
441
|
* @memberof Settings */
|
|
442
442
|
export function setHeadlessMode(headless: boolean): void;
|
|
@@ -460,7 +460,7 @@ declare module "littlejsengine" {
|
|
|
460
460
|
* @param {Boolean} enable
|
|
461
461
|
* @memberof Settings */
|
|
462
462
|
export function setEnablePhysicsSolver(enable: boolean): void;
|
|
463
|
-
/** Set default object mass for
|
|
463
|
+
/** Set default object mass for collision calculations
|
|
464
464
|
* @param {Number} mass
|
|
465
465
|
* @memberof Settings */
|
|
466
466
|
export function setObjectDefaultMass(mass: number): void;
|
|
@@ -516,7 +516,7 @@ declare module "littlejsengine" {
|
|
|
516
516
|
* @param {Boolean} analog
|
|
517
517
|
* @memberof Settings */
|
|
518
518
|
export function setTouchGamepadAnalog(analog: boolean): void;
|
|
519
|
-
/** Set size of
|
|
519
|
+
/** Set size of virtual gamepad for touch devices in pixels
|
|
520
520
|
* @param {Number} size
|
|
521
521
|
* @memberof Settings */
|
|
522
522
|
export function setTouchGamepadSize(size: number): void;
|
|
@@ -586,7 +586,7 @@ declare module "littlejsengine" {
|
|
|
586
586
|
* @default Math.PI
|
|
587
587
|
* @memberof Utilities */
|
|
588
588
|
export const PI: number;
|
|
589
|
-
/** Returns
|
|
589
|
+
/** Returns absolute value of value passed in
|
|
590
590
|
* @param {Number} value
|
|
591
591
|
* @return {Number}
|
|
592
592
|
* @memberof Utilities */
|
|
@@ -614,7 +614,7 @@ declare module "littlejsengine" {
|
|
|
614
614
|
* @return {Number}
|
|
615
615
|
* @memberof Utilities */
|
|
616
616
|
export function mod(dividend: number, divisor?: number): number;
|
|
617
|
-
/** Clamps the value
|
|
617
|
+
/** Clamps the value between max and min
|
|
618
618
|
* @param {Number} value
|
|
619
619
|
* @param {Number} [min]
|
|
620
620
|
* @param {Number} [max]
|
|
@@ -856,11 +856,11 @@ declare module "littlejsengine" {
|
|
|
856
856
|
* @param {Number} angle
|
|
857
857
|
* @return {Vector2} */
|
|
858
858
|
rotate(angle: number): Vector2;
|
|
859
|
-
/** Set the integer direction of this vector,
|
|
859
|
+
/** Set the integer direction of this vector, corresponding to multiples of 90 degree rotation (0-3)
|
|
860
860
|
* @param {Number} [direction]
|
|
861
861
|
* @param {Number} [length] */
|
|
862
862
|
setDirection(direction?: number, length?: number): Vector2;
|
|
863
|
-
/** Returns the integer direction of this vector,
|
|
863
|
+
/** Returns the integer direction of this vector, corresponding to multiples of 90 degree rotation (0-3)
|
|
864
864
|
* @return {Number} */
|
|
865
865
|
direction(): number;
|
|
866
866
|
/** Returns a copy of this vector that has been inverted
|
|
@@ -989,7 +989,7 @@ declare module "littlejsengine" {
|
|
|
989
989
|
* a.set(3); // sets the timer to 3 seconds
|
|
990
990
|
*
|
|
991
991
|
* let b = new Timer(1); // creates a timer with 1 second left
|
|
992
|
-
* b.unset(); //
|
|
992
|
+
* b.unset(); // unset the timer
|
|
993
993
|
*/
|
|
994
994
|
export class Timer {
|
|
995
995
|
/** Create a timer object set time passed in
|
|
@@ -1109,9 +1109,9 @@ declare module "littlejsengine" {
|
|
|
1109
1109
|
* @memberof Utilities */
|
|
1110
1110
|
export const MAGENTA: Color;
|
|
1111
1111
|
/** Array containing texture info for batch rendering system
|
|
1112
|
-
* @type {Array}
|
|
1112
|
+
* @type {Array<TextureInfo>}
|
|
1113
1113
|
* @memberof Draw */
|
|
1114
|
-
export let textureInfos:
|
|
1114
|
+
export let textureInfos: Array<TextureInfo>;
|
|
1115
1115
|
/**
|
|
1116
1116
|
* Create a tile info object using a grid based system
|
|
1117
1117
|
* - This can take vecs or floats for easier use and conversion
|
|
@@ -1302,12 +1302,6 @@ declare module "littlejsengine" {
|
|
|
1302
1302
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1303
1303
|
* @memberof Draw */
|
|
1304
1304
|
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1305
|
-
/** Enable normal or additive blend mode
|
|
1306
|
-
* @param {Boolean} [additive]
|
|
1307
|
-
* @param {Boolean} [useWebGL=glEnable]
|
|
1308
|
-
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1309
|
-
* @memberof Draw */
|
|
1310
|
-
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1311
1305
|
/** Draw text on main canvas in world space
|
|
1312
1306
|
* Automatically splits new lines into rows
|
|
1313
1307
|
* @param {String} text
|
|
@@ -1349,6 +1343,16 @@ declare module "littlejsengine" {
|
|
|
1349
1343
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
|
|
1350
1344
|
* @memberof Draw */
|
|
1351
1345
|
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1346
|
+
/** Enable normal or additive blend mode
|
|
1347
|
+
* @param {Boolean} [additive]
|
|
1348
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
1349
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1350
|
+
* @memberof Draw */
|
|
1351
|
+
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1352
|
+
/** Combines all LittleJS canvases onto the main canvas and clears them
|
|
1353
|
+
* This is necessary for things like saving a screenshot
|
|
1354
|
+
* @memberof Draw */
|
|
1355
|
+
export function combineCanvases(): void;
|
|
1352
1356
|
export let engineFontImage: any;
|
|
1353
1357
|
/**
|
|
1354
1358
|
* Font Image Object - Draw text on a 2D canvas by using characters in an image
|
|
@@ -1357,7 +1361,7 @@ declare module "littlejsengine" {
|
|
|
1357
1361
|
* - You can also use fonts from the main tile sheet
|
|
1358
1362
|
* @example
|
|
1359
1363
|
* // use built in font
|
|
1360
|
-
* const font = new
|
|
1364
|
+
* const font = new FontImage;
|
|
1361
1365
|
*
|
|
1362
1366
|
* // draw text
|
|
1363
1367
|
* font.drawTextScreen("LittleJS\nHello World!", vec2(200, 50));
|
|
@@ -1393,9 +1397,13 @@ declare module "littlejsengine" {
|
|
|
1393
1397
|
* @return {Boolean}
|
|
1394
1398
|
* @memberof Draw */
|
|
1395
1399
|
export function isFullscreen(): boolean;
|
|
1396
|
-
/** Toggle
|
|
1400
|
+
/** Toggle fullscreen mode
|
|
1397
1401
|
* @memberof Draw */
|
|
1398
1402
|
export function toggleFullscreen(): void;
|
|
1403
|
+
/** Set the cursor style
|
|
1404
|
+
* @param {String} cursorStyle - CSS cursor style (auto, none, crosshair, etc)
|
|
1405
|
+
* @memberof Draw */
|
|
1406
|
+
export function setCursor(cursorStyle?: string): void;
|
|
1399
1407
|
/** Get the camera's visible area in world space
|
|
1400
1408
|
* @return {Vector2}
|
|
1401
1409
|
* @memberof Draw */
|
|
@@ -1425,7 +1433,7 @@ declare module "littlejsengine" {
|
|
|
1425
1433
|
* @return {WebGLShader}
|
|
1426
1434
|
* @memberof WebGL */
|
|
1427
1435
|
export function glCompileShader(source: string, type: number): WebGLShader;
|
|
1428
|
-
/** Draw any sprites still in the buffer
|
|
1436
|
+
/** Draw any sprites still in the buffer and copy to main canvas
|
|
1429
1437
|
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context
|
|
1430
1438
|
* @param {Boolean} [forceDraw]
|
|
1431
1439
|
* @memberof WebGL */
|
|
@@ -1463,11 +1471,14 @@ declare module "littlejsengine" {
|
|
|
1463
1471
|
* @param {WebGLTexture} texture
|
|
1464
1472
|
* @memberof WebGL */
|
|
1465
1473
|
export function glSetTexture(texture: WebGLTexture): void;
|
|
1466
|
-
/** Set
|
|
1474
|
+
/** Set anti-aliasing for webgl canvas
|
|
1467
1475
|
* @param {Boolean} [antialias]
|
|
1468
1476
|
* @memberof WebGL */
|
|
1469
1477
|
export function glSetAntialias(antialias?: boolean): void;
|
|
1470
|
-
/**
|
|
1478
|
+
/** Clear the canvas and setup the viewport
|
|
1479
|
+
* @memberof WebGL */
|
|
1480
|
+
export function glClearCanvas(): void;
|
|
1481
|
+
/** Should webgl be setup with anti-aliasing? must be set before calling engineInit
|
|
1471
1482
|
* @type {Boolean}
|
|
1472
1483
|
* @memberof WebGL */
|
|
1473
1484
|
export let glAntialias: boolean;
|
|
@@ -1892,7 +1903,7 @@ declare module "littlejsengine" {
|
|
|
1892
1903
|
worldToLocalVector(vec: Vector2): Vector2;
|
|
1893
1904
|
/** Called to check if a tile collision should be resolved
|
|
1894
1905
|
* @param {Number} tileData - the value of the tile at the position
|
|
1895
|
-
* @param {Vector2} pos - tile where the collision
|
|
1906
|
+
* @param {Vector2} pos - tile where the collision occurred
|
|
1896
1907
|
* @return {Boolean} - true if the collision should be resolved */
|
|
1897
1908
|
collideWithTile(tileData: number, pos: Vector2): boolean;
|
|
1898
1909
|
/** Called to check if a object collision should be resolved
|
|
@@ -1926,7 +1937,7 @@ declare module "littlejsengine" {
|
|
|
1926
1937
|
* @param {Boolean} [collideTiles] - Does it collide with the tile collision?
|
|
1927
1938
|
* @param {Boolean} [collideRaycast] - Does it collide with raycasts? */
|
|
1928
1939
|
setCollision(collideSolidObjects?: boolean, isSolid?: boolean, collideTiles?: boolean, collideRaycast?: boolean): void;
|
|
1929
|
-
/** Returns string
|
|
1940
|
+
/** Returns string containing info about this object for debugging
|
|
1930
1941
|
* @return {String} */
|
|
1931
1942
|
toString(): string;
|
|
1932
1943
|
/** Render debug info for this object */
|
|
@@ -2049,12 +2060,12 @@ declare module "littlejsengine" {
|
|
|
2049
2060
|
redrawEnd(): void;
|
|
2050
2061
|
/** Draw the tile at a given position in the tile grid
|
|
2051
2062
|
* This can be used to clear out tiles when they are destroyed
|
|
2052
|
-
* Tiles can also be redrawn if
|
|
2063
|
+
* Tiles can also be redrawn if inside a redrawStart/End block
|
|
2053
2064
|
* @param {Vector2} layerPos
|
|
2054
2065
|
* @param {Boolean} [clear] - should the old tile be cleared out
|
|
2055
2066
|
*/
|
|
2056
2067
|
drawTileData(layerPos: Vector2, clear?: boolean): void;
|
|
2057
|
-
/** Draw directly to the 2D canvas in world space (
|
|
2068
|
+
/** Draw directly to the 2D canvas in world space (bypass webgl)
|
|
2058
2069
|
* @param {Vector2} pos
|
|
2059
2070
|
* @param {Vector2} size
|
|
2060
2071
|
* @param {Number} angle
|
|
@@ -2098,7 +2109,7 @@ declare module "littlejsengine" {
|
|
|
2098
2109
|
* let pos = vec2(2,3);
|
|
2099
2110
|
* let particleEmitter = new ParticleEmitter
|
|
2100
2111
|
* (
|
|
2101
|
-
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate,
|
|
2112
|
+
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emitCone
|
|
2102
2113
|
* tile(0, 16), // tileInfo
|
|
2103
2114
|
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
|
|
2104
2115
|
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
|
|
@@ -2132,7 +2143,7 @@ declare module "littlejsengine" {
|
|
|
2132
2143
|
* @param {Number} [fadeRate] - How quick to fade particles at start/end in percent of life
|
|
2133
2144
|
* @param {Number} [randomness] - Apply extra randomness percent
|
|
2134
2145
|
* @param {Boolean} [collideTiles] - Do particles collide against tiles
|
|
2135
|
-
* @param {Boolean} [additive] - Should particles use
|
|
2146
|
+
* @param {Boolean} [additive] - Should particles use additive blend
|
|
2136
2147
|
* @param {Boolean} [randomColorLinear] - Should color be randomized linearly or across each component
|
|
2137
2148
|
* @param {Number} [renderOrder] - Render order for particles (additive is above other stuff by default)
|
|
2138
2149
|
* @param {Boolean} [localSpace] - Should it be in local space of emitter (world space is default)
|
|
@@ -2172,11 +2183,11 @@ declare module "littlejsengine" {
|
|
|
2172
2183
|
fadeRate: number;
|
|
2173
2184
|
/** @property {Number} - Apply extra randomness percent */
|
|
2174
2185
|
randomness: number;
|
|
2175
|
-
/** @property {Boolean} - Should particles use
|
|
2186
|
+
/** @property {Boolean} - Should particles use additive blend */
|
|
2176
2187
|
additive: boolean;
|
|
2177
2188
|
/** @property {Boolean} - Should it be in local space of emitter */
|
|
2178
2189
|
localSpace: boolean;
|
|
2179
|
-
/** @property {Number} - If non zero the
|
|
2190
|
+
/** @property {Number} - If non zero the particle is drawn as a trail, stretched in the direction of velocity */
|
|
2180
2191
|
trailScale: number;
|
|
2181
2192
|
/** @property {Function} - Callback when particle is destroyed */
|
|
2182
2193
|
particleDestroyCallback: any;
|