littlejsengine 1.6.4 → 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.
- package/README.md +61 -41
- package/build/littlejs.d.ts +160 -165
- package/build/littlejs.esm.js +451 -367
- package/build/littlejs.esm.min.js +1 -1
- package/build/littlejs.js +408 -314
- package/build/littlejs.min.js +1 -1
- package/build/littlejs.release.js +2573 -2470
- package/examples/breakout/game.js +5 -1
- package/examples/breakout/index.html +5 -5
- package/examples/breakoutTutorial/README.md +6 -6
- package/examples/breakoutTutorial/game.js +3 -0
- package/examples/breakoutTutorial/index.html +3 -3
- package/examples/electron/build.js +105 -0
- package/examples/electron/game.js +4 -2
- package/examples/electron/index.html +13 -2
- package/examples/electron/package.json +5 -3
- package/examples/empty/game.js +3 -1
- package/examples/empty/index.html +1 -1
- package/examples/favicon.png +0 -0
- package/examples/js13k/build.bat +2 -0
- package/examples/js13k/build.js +110 -0
- package/examples/js13k/game.js +109 -0
- package/examples/js13k/index.html +18 -0
- package/examples/js13k/tiles.png +0 -0
- package/examples/module/game.js +9 -3
- package/examples/module/index.html +2 -2
- package/examples/particles/index.html +7 -13
- package/examples/platformer/game.js +5 -2
- package/examples/platformer/gameEffects.js +1 -2
- package/examples/platformer/gamePlayer.js +2 -2
- package/examples/platformer/index.html +8 -8
- package/examples/puzzle/game.js +6 -4
- package/examples/puzzle/index.html +4 -4
- package/examples/starter/build.bat +2 -78
- package/examples/starter/build.js +109 -0
- package/examples/starter/game.js +4 -1
- package/examples/starter/index.html +15 -18
- package/examples/stress/index.html +2 -4
- package/examples/typescript/build.bat +2 -14
- package/examples/typescript/build.js +31 -0
- package/examples/typescript/game.js +94 -89
- package/examples/typescript/game.ts +9 -3
- package/examples/typescript/index.html +2 -2
- package/package.json +3 -3
- package/src/engine.js +30 -31
- package/src/engineAudio.js +44 -20
- package/src/engineBuild.bat +2 -132
- package/src/engineBuild.js +143 -0
- package/src/engineDebug.js +21 -32
- package/src/engineDraw.js +36 -28
- package/src/engineExport.js +41 -51
- package/src/engineInput.js +33 -20
- package/src/engineMedals.js +31 -8
- package/src/engineObject.js +34 -32
- package/src/engineParticles.js +9 -12
- package/src/engineRelease.js +18 -20
- package/src/engineSettings.js +4 -4
- package/src/engineTileLayer.js +49 -32
- package/src/engineUtilities.js +96 -74
- package/src/engineWebGL.js +8 -8
- package/examples/electron/build.bat +0 -52
package/README.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
#  LittleJS - The Tiny JavaScript Game Engine That Can
|
|
2
2
|
|
|
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]
|
|
8
|
+
|
|
3
9
|
## All aboard!
|
|
4
10
|
|
|
5
|
-
LittleJS is a super lightweight JavaScript game engine
|
|
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! 🚂
|
|
6
12
|
<div align="center">
|
|
7
13
|
|
|
8
14
|
## [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/tree/main/examples/breakoutTutorial)
|
|
@@ -23,37 +29,39 @@ LittleJS is a super lightweight JavaScript game engine with a fast hybrid render
|
|
|
23
29
|
|
|
24
30
|
LittleJS is a small but powerful game engine with many features and no depenencies.
|
|
25
31
|
|
|
26
|
-
Graphics
|
|
32
|
+
### Graphics
|
|
27
33
|
|
|
28
|
-
-
|
|
34
|
+
- Super fast sprite and tile map rendering engine with WebGL
|
|
29
35
|
- Update and render 10,000+ objects at 60fps, often many times more
|
|
30
36
|
- Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post processinge effects
|
|
31
37
|
|
|
32
|
-
Audio
|
|
38
|
+
### Audio
|
|
33
39
|
|
|
34
40
|
- Positional sound effects with [ZzFX](https://killedbyapixel.github.io/ZzFX/) sound effect generator
|
|
35
41
|
- Music with [ZzFXM](https://keithclark.github.io/ZzFXM/), mp3, or wav audio
|
|
36
42
|
|
|
37
|
-
Input
|
|
43
|
+
### Input
|
|
38
44
|
|
|
39
45
|
- Input processing system for keyboard, mouse, gamepad, and touch
|
|
46
|
+
- On screen touch gamepad for mobile devices
|
|
40
47
|
|
|
41
|
-
Physics
|
|
48
|
+
### Physics
|
|
42
49
|
|
|
43
50
|
- 2D physics engine with collision handling for axis aligned boxes
|
|
44
|
-
- Very fast collision handling for tile maps
|
|
51
|
+
- Very fast collision handling and raycasting for tile maps
|
|
45
52
|
|
|
46
|
-
Flexability
|
|
53
|
+
### Flexability
|
|
47
54
|
|
|
48
55
|
- Designed to work with all modern web bowsers and mobile devices
|
|
49
56
|
- Compatible with TypeScript and includes [an example TS project](https://killedbyapixel.github.io/LittleJS/examples/typescript)
|
|
50
|
-
- For size coding competitions like [js13kGames](https://js13kgames.com/),
|
|
51
|
-
-
|
|
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
|
|
52
59
|
- Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
### And more...
|
|
55
62
|
|
|
56
|
-
-
|
|
63
|
+
- Node.js build system
|
|
64
|
+
- Debug primitives rendering system
|
|
57
65
|
- Particle effects system and design tool
|
|
58
66
|
- Bitmap font rendering and includes a built in engine font
|
|
59
67
|
- Medal system tracks and displays achievements with Newgrounds integration
|
|
@@ -62,13 +70,11 @@ Extra Systems
|
|
|
62
70
|
|
|
63
71
|
To use LittleJS download the latest package from GitHub or call ```npm install littlejsengine```. This package contains the engine and several small examples.
|
|
64
72
|
|
|
65
|
-
[You can use the empty example template as a starting point.](https://github.com/KilledByAPixel/LittleJS/blob/main/examples/empty/game.js) This file
|
|
66
|
-
|
|
67
|
-
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).
|
|
68
74
|
|
|
69
|
-
|
|
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.
|
|
70
76
|
|
|
71
|
-
|
|
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)
|
|
72
78
|
|
|
73
79
|
## Builds
|
|
74
80
|
|
|
@@ -85,7 +91,29 @@ LittleJS can also be imported as a module. There are two module flavors that are
|
|
|
85
91
|
|
|
86
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.
|
|
87
93
|
|
|
88
|
-
The starter project
|
|
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
|
|
89
117
|
|
|
90
118
|
## LittleJS Setup
|
|
91
119
|
|
|
@@ -154,35 +182,15 @@ class MyObject extends EngineObject
|
|
|
154
182
|
}
|
|
155
183
|
```
|
|
156
184
|
|
|
157
|
-
## Engine Source Code
|
|
158
|
-
|
|
159
|
-
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.
|
|
160
|
-
|
|
161
|
-
- [engine.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engine.js) - Top level engine init, update, and render
|
|
162
|
-
- [engineSettings.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineSettings.js) - Global engine settings
|
|
163
|
-
- [engineObject.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineObject.js) - Base object class and physics
|
|
164
|
-
- [engineDraw.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDraw.js) - Code for canvas drawing and text
|
|
165
|
-
- [engineAudio.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineAudio.js) - Spacial sound effects, and zzfx sound generator
|
|
166
|
-
- [engineInput.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineInput.js) - Input for keyboard, mouse, touch, and gamepad
|
|
167
|
-
- [engineUtilities.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineUtilities.js) - Vector2, Color, and Timer clases and math functions
|
|
168
|
-
|
|
169
|
-
Optional Components, these components are built to synergize with the rest of the engine but are not necessary.
|
|
170
|
-
|
|
171
|
-
- [engineTileLayer.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineTileLayer.js) - Tile layer rendering and collision
|
|
172
|
-
- [engineParticles.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineParticles.js) - Particle system with fast rendering and collision
|
|
173
|
-
- [engineWebGL.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineWebGL.js) - Super fast rendering with WebGL and post processing
|
|
174
|
-
- [engineMedals.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineMedals.js) - Achievement tracker with Newgrounds integration
|
|
175
|
-
- [engineDebug.js](https://github.com/KilledByAPixel/LittleJS/blob/main/src/engineDebug.js) - Debug rendering system and information overlay
|
|
176
|
-
|
|
177
185
|
## Debugging
|
|
178
186
|
|
|
179
|
-
Debug builds of LittleJS have a special menu that can be opened by pressing
|
|
187
|
+
Debug builds of LittleJS have a special menu that can be opened by pressing the Esc key.
|
|
180
188
|
|
|
181
|
-
-
|
|
189
|
+
- Esc: Debug Overlay
|
|
182
190
|
- 1: Debug Physics
|
|
183
191
|
- 2: Debug Particles
|
|
184
192
|
- 3: Debug Gamepads
|
|
185
|
-
- 4:
|
|
193
|
+
- 4: Debug Raycasts
|
|
186
194
|
- 5: Save Screenshot
|
|
187
195
|
|
|
188
196
|
## Games Made With LittleJS
|
|
@@ -198,6 +206,18 @@ Here are a few of the amazing games people are making with LittleJS.
|
|
|
198
206
|
- [Bit Butcher](https://js13kgames.com/entries/bit-butcher) - Survival crafting game by [Deathray Games](https://github.com/deathraygames/bit-butcher)
|
|
199
207
|
- [Necrotic Commander](https://js13kgames.com/entries/necrotic-commander) - Tower defense game by [Daniel Jeffery](https://github.com/d-jeffery/NecroticCommander)
|
|
200
208
|
- [Boxing up Bamboo](https://patrickgh3.itch.io/boxing-up-bamboo) - A challenging puzzle game by [Patrick Traynor](https://cwpat.me/about)
|
|
209
|
+
- [Samurai Sam](https://dev.js13kgames.com/2023/games/samurai-sam) - A Fruit Ninja inspired game by [John Edvard](https://reitgames.com)
|
|
201
210
|
- Send me your games!
|
|
202
211
|
|
|
203
212
|

|
|
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
|