littlejsengine 1.4.7 → 1.4.9
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/build.bat +7 -3
- package/engine/engine.all.js +291 -323
- package/engine/engine.all.min.js +1 -1
- package/engine/engine.all.module.js +307 -352
- package/engine/engine.all.module.min.js +1 -0
- package/engine/engine.all.release.js +291 -323
- package/engine/engine.js +21 -30
- package/engine/engineAudio.js +8 -15
- package/engine/engineBuild.bat +10 -3
- package/engine/engineDraw.js +18 -24
- package/engine/engineExport.js +16 -29
- package/engine/engineInput.js +84 -71
- package/engine/engineMedals.js +30 -38
- package/engine/engineObject.js +8 -8
- package/engine/engineParticles.js +5 -4
- package/engine/engineSettings.js +38 -38
- package/engine/engineTileLayer.js +15 -16
- package/engine/engineUtilities.js +26 -13
- package/engine/engineWebGL.js +38 -66
- package/engine/index.d.ts +65 -54
- package/examples/breakout/game.js +10 -10
- package/examples/breakout/gameObjects.js +7 -7
- package/examples/breakout/index.html +3 -3
- package/examples/empty/tiles.png +0 -0
- package/examples/module/game.js +5 -7
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +4 -14
- package/examples/platformer/index.html +6 -6
- package/examples/puzzle/index.html +2 -2
- package/examples/stress/index.html +1 -1
- package/favicon.png +0 -0
- package/game.js +6 -9
- package/index.html +13 -13
- package/package.json +1 -1
- package/README.md +0 -75
- package/engine/engine.all.release.module.js +0 -4464
|
@@ -15,18 +15,7 @@ button
|
|
|
15
15
|
</style>
|
|
16
16
|
</head><body>
|
|
17
17
|
|
|
18
|
-
<script src=../../engine/
|
|
19
|
-
<script src=../../engine/engineUtilities.js?120></script>
|
|
20
|
-
<script src=../../engine/engineSettings.js?120></script>
|
|
21
|
-
<script src=../../engine/engineObject.js?120></script>
|
|
22
|
-
<script src=../../engine/engineDraw.js?120></script>
|
|
23
|
-
<script src=../../engine/engineInput.js?120></script>
|
|
24
|
-
<script src=../../engine/engineAudio.js?120></script>
|
|
25
|
-
<script src=../../engine/engineTileLayer.js?120></script>
|
|
26
|
-
<script src=../../engine/engineParticles.js?120></script>
|
|
27
|
-
<script src=../../engine/engineMedals.js?120></script>
|
|
28
|
-
<script src=../../engine/engineWebGL.js?120></script>
|
|
29
|
-
<script src=../../engine/engine.js?120></script>
|
|
18
|
+
<script src=../../engine/engine.all.js?123></script>
|
|
30
19
|
<script>
|
|
31
20
|
|
|
32
21
|
'use strict';
|
|
@@ -74,6 +63,8 @@ addSetting('randomColorLinear','checkbox',0,0,0, 'Should color be randomized li
|
|
|
74
63
|
|
|
75
64
|
function makeEmitter()
|
|
76
65
|
{
|
|
66
|
+
if (particleSystem)
|
|
67
|
+
particleSystem.destroy();
|
|
77
68
|
particleSystem = new ParticleEmitter(cameraPos);
|
|
78
69
|
particleSystem.emitConeAngle =
|
|
79
70
|
particleSystem.particleConeAngle = 3.14;
|
|
@@ -84,7 +75,7 @@ function gameInit()
|
|
|
84
75
|
{
|
|
85
76
|
makeEmitter();
|
|
86
77
|
gravity = -.01;
|
|
87
|
-
cameraScale =
|
|
78
|
+
cameraScale = 64;
|
|
88
79
|
|
|
89
80
|
const div = particleSystemDiv = document.createElement('div');
|
|
90
81
|
div.innerHTML = '<big><b>LittleJS Particle Tool';
|
|
@@ -175,7 +166,6 @@ function gameInit()
|
|
|
175
166
|
{
|
|
176
167
|
if (!confirm('Reset to default?'))
|
|
177
168
|
return;
|
|
178
|
-
particleSystem.destroy();
|
|
179
169
|
makeEmitter();
|
|
180
170
|
updateInputs(0);
|
|
181
171
|
cameraScale = 50;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<link rel=icon type=image/png href=../../favicon.png>
|
|
6
6
|
</head><body>
|
|
7
7
|
|
|
8
|
-
<script src=../../engine/engine.all.js?
|
|
9
|
-
<script src=gameObjects.js?
|
|
10
|
-
<script src=gamePlayer.js?
|
|
11
|
-
<script src=gameEffects.js?
|
|
12
|
-
<script src=gameLevel.js?
|
|
13
|
-
<script src=game.js?
|
|
8
|
+
<script src=../../engine/engine.all.js?123></script>
|
|
9
|
+
<script src=gameObjects.js?123></script>
|
|
10
|
+
<script src=gamePlayer.js?123></script>
|
|
11
|
+
<script src=gameEffects.js?123></script>
|
|
12
|
+
<script src=gameLevel.js?123></script>
|
|
13
|
+
<script src=game.js?123></script>
|
package/favicon.png
CHANGED
|
Binary file
|
package/game.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
7
|
// sound effects
|
|
8
|
-
const sound_click = new Sound([
|
|
8
|
+
const sound_click = new Sound([1,.5]);
|
|
9
9
|
|
|
10
10
|
// medals
|
|
11
11
|
const medal_example = new Medal(0, 'Example Medal', 'Welcome to LittleJS!');
|
|
@@ -19,8 +19,8 @@ function gameInit()
|
|
|
19
19
|
{
|
|
20
20
|
// create tile collision and visible tile layer
|
|
21
21
|
initTileCollision(vec2(32, 16));
|
|
22
|
-
const tileLayer = new TileLayer(vec2(), tileCollisionSize);
|
|
23
22
|
const pos = vec2();
|
|
23
|
+
const tileLayer = new TileLayer(pos, tileCollisionSize);
|
|
24
24
|
|
|
25
25
|
// get level data from the tiles image
|
|
26
26
|
const imageLevelDataRow = 1;
|
|
@@ -28,32 +28,29 @@ function gameInit()
|
|
|
28
28
|
for (pos.x = tileCollisionSize.x; pos.x--;)
|
|
29
29
|
for (pos.y = tileCollisionSize.y; pos.y--;)
|
|
30
30
|
{
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
31
|
+
const imageData = mainContext.getImageData(pos.x, 16*(imageLevelDataRow+1)-pos.y-1, 1, 1).data;
|
|
32
|
+
if (imageData[0])
|
|
33
33
|
{
|
|
34
|
-
setTileCollisionData(pos, 1);
|
|
35
|
-
|
|
36
34
|
const tileIndex = 1;
|
|
37
35
|
const direction = randInt(4)
|
|
38
36
|
const mirror = randInt(2);
|
|
39
37
|
const color = randColor();
|
|
40
38
|
const data = new TileLayerData(tileIndex, direction, mirror, color);
|
|
41
39
|
tileLayer.setData(pos, data);
|
|
40
|
+
setTileCollisionData(pos, 1);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
tileLayer.redraw();
|
|
45
44
|
|
|
46
45
|
// move camera to center of collision
|
|
47
46
|
cameraPos = tileCollisionSize.scale(.5);
|
|
48
|
-
cameraScale = 32;
|
|
49
47
|
|
|
50
48
|
// enable gravity
|
|
51
49
|
gravity = -.01;
|
|
52
50
|
|
|
53
51
|
// create particle emitter
|
|
54
|
-
const center = tileCollisionSize.scale(.5).add(vec2(0,9));
|
|
55
52
|
particleEmiter = new ParticleEmitter(
|
|
56
|
-
|
|
53
|
+
vec2(16), 0, // emitPos, emitAngle
|
|
57
54
|
1, 0, 500, PI, // emitSize, emitTime, emitRate, emiteCone
|
|
58
55
|
0, vec2(16), // tileIndex, tileSize
|
|
59
56
|
new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
|
package/index.html
CHANGED
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
</head><body>
|
|
7
7
|
|
|
8
8
|
<!-- LittleJS engine scripts -->
|
|
9
|
-
<script src=engine/engineDebug.js?
|
|
10
|
-
<script src=engine/engineUtilities.js?
|
|
11
|
-
<script src=engine/engineSettings.js?
|
|
12
|
-
<script src=engine/engineObject.js?
|
|
13
|
-
<script src=engine/engineDraw.js?
|
|
14
|
-
<script src=engine/engineInput.js?
|
|
15
|
-
<script src=engine/engineAudio.js?
|
|
16
|
-
<script src=engine/engineTileLayer.js?
|
|
17
|
-
<script src=engine/engineParticles.js?
|
|
18
|
-
<script src=engine/engineMedals.js?
|
|
19
|
-
<script src=engine/engineWebGL.js?
|
|
20
|
-
<script src=engine/engine.js?
|
|
9
|
+
<script src=engine/engineDebug.js?123></script>
|
|
10
|
+
<script src=engine/engineUtilities.js?123></script>
|
|
11
|
+
<script src=engine/engineSettings.js?123></script>
|
|
12
|
+
<script src=engine/engineObject.js?123></script>
|
|
13
|
+
<script src=engine/engineDraw.js?123></script>
|
|
14
|
+
<script src=engine/engineInput.js?123></script>
|
|
15
|
+
<script src=engine/engineAudio.js?123></script>
|
|
16
|
+
<script src=engine/engineTileLayer.js?123></script>
|
|
17
|
+
<script src=engine/engineParticles.js?123></script>
|
|
18
|
+
<script src=engine/engineMedals.js?123></script>
|
|
19
|
+
<script src=engine/engineWebGL.js?123></script>
|
|
20
|
+
<script src=engine/engine.js?123></script>
|
|
21
21
|
|
|
22
22
|
<!-- You can also include all engine scripts like this... -->
|
|
23
23
|
<!-- <script src=engine/engine.all.js></script> -->
|
|
24
24
|
|
|
25
25
|
<!-- Add your game scripts here -->
|
|
26
|
-
<script src=game.js?
|
|
26
|
+
<script src=game.js?123></script>
|
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#  LittleJS - The Tiny JavaScript Game Engine That Can
|
|
2
|
-
|
|
3
|
-
## All aboard!
|
|
4
|
-
|
|
5
|
-
LittleJS is a super lightweight JavaScript game engine with a fast hybrid rendering system. It provides a comprehensive set of tools including rendering, physics, particles, sound effects, music, input handling, and debug tools. The code is very clean and well documented with a variety of examples to get you started. Choo-Choo! 🚂
|
|
6
|
-
<div align="center">
|
|
7
|
-
|
|
8
|
-
## [Demo](https://killedbyapixel.github.io/LittleJS) | [Docs](https://killedbyapixel.github.io/LittleJS/docs) | [Trailer](https://youtu.be/chuBzGjv7Ms) | [Discord](https://discord.gg/zb7hcGkyZe)
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
## Examples
|
|
14
|
-
|
|
15
|
-
### [Hello World](https://killedbyapixel.github.io/LittleJS/) - Clean project with only a few things to get you started
|
|
16
|
-
### [Puzzle Game](https://killedbyapixel.github.io/LittleJS/examples/puzzle) - Match 3 puzzle game with HD rendering and high score tracking
|
|
17
|
-
### [Platformer](https://killedbyapixel.github.io/LittleJS/examples/platformer) - Platformer/shooter with procedural generation and destruction
|
|
18
|
-
### [Breakout](https://killedbyapixel.github.io/LittleJS/examples/breakout) - Breakout game with post processing effect
|
|
19
|
-
### [Stress Test](https://killedbyapixel.github.io/LittleJS/examples/stress) - Max sprite/object test and music system demo
|
|
20
|
-
### [Particle System Designer](https://killedbyapixel.github.io/LittleJS/examples/particles) - Particle system editor and visualizer
|
|
21
|
-
|
|
22
|
-
## Features
|
|
23
|
-
|
|
24
|
-
- Very small footprint with no dependencies
|
|
25
|
-
- Can update and render 10,000+ objects at 60fps, often many times more
|
|
26
|
-
- Object oriented system with fast 2D physics and collision handling for axis aligned boxes
|
|
27
|
-
- Positional audio effects with [ZzFX](https://killedbyapixel.github.io/ZzFX/) and music with [ZzFXM](https://keithclark.github.io/ZzFXM/), mp3s, or wavs
|
|
28
|
-
- Input processing system with keyboard, mouse, gamepad, and touch support
|
|
29
|
-
- Particle effects system (particle editor/designer in progress)
|
|
30
|
-
- Medal system tracks and displays achievements with Newgrounds and OS13k integration
|
|
31
|
-
- Several easy to understand example projects you can build on
|
|
32
|
-
- Apply [Shadertoy](https://www.shadertoy.com) compatible shaders for post processinge effects
|
|
33
|
-
- Debug tools and debug rendering system
|
|
34
|
-
- [Full documentation](https://killedbyapixel.github.io/LittleJS/docs) automatically generated from the source code block tags with [JSDoc](https://github.com/jsdoc/jsdoc)
|
|
35
|
-
- Build system automatically combines everything, minifies, and removes unused code
|
|
36
|
-
- For size coding competitions like [js13kGames](https://js13kgames.com/), starter project builds to a 7KB zip file
|
|
37
|
-
- Easily build a Windows executable with [Electron](https://www.electronjs.org/) for distribution on platforms like Steam
|
|
38
|
-
- Open Source with the [MIT license](https://github.com/KilledByAPixel/LittleJS/blob/main/LICENSE) so it can be used for anything you want
|
|
39
|
-
- Can be imported as a JavaScript module and includes [an example module project](https://killedbyapixel.github.io/LittleJS/examples/module)
|
|
40
|
-
|
|
41
|
-
## Builds
|
|
42
|
-
|
|
43
|
-
To easily include LittleJS in your game, you can use one of the 3 pre-built js files. These are also built automatically by the build scripts.
|
|
44
|
-
|
|
45
|
-
- [engine.all.js](https://github.com/KilledByAPixel/LittleJS/blob/main/engine/engine.all.js) - The full game engine with debug mode available
|
|
46
|
-
- [engine.all.release.js](https://github.com/KilledByAPixel/LittleJS/blob/main/engine/engine.all.release.js) - The engine optimized for release builds
|
|
47
|
-
- [engine.all.min.js](https://github.com/KilledByAPixel/LittleJS/blob/main/engine/engine.all.min.js) - The engine in release mode and minified
|
|
48
|
-
|
|
49
|
-
The hello world example includes a batch file [build.bat](https://github.com/KilledByAPixel/LittleJS/blob/main/build.bat) that compresses everything into a tiny zip file using Google Closure, UglifyJS, Roadroller, and ECT. You must run [buildSetup.bat](https://github.com/KilledByAPixel/LittleJS/blob/main/buildSetup.bat) to install the necessary npm dependencies.
|
|
50
|
-
|
|
51
|
-
## Debugging
|
|
52
|
-
|
|
53
|
-
Debug builds of LittleJS have a special menu that can be opened by pressing ~, the tilde key.
|
|
54
|
-
|
|
55
|
-
- ~: Debug Overlay
|
|
56
|
-
- 1: Debug Physics
|
|
57
|
-
- 2: Debug Particles
|
|
58
|
-
- 3: Debug Gamepads
|
|
59
|
-
- 4: God Mode
|
|
60
|
-
- 5: Save Screenshot
|
|
61
|
-
|
|
62
|
-
## Games Made With LittleJS
|
|
63
|
-
|
|
64
|
-
- [Space Huggers](https://www.newgrounds.com/portal/view/819609) - Run and gun platformer with procedural levels
|
|
65
|
-
- [Undergrowth](https://undergrowth.squidband.uk/) - An interactive music videogame for the band Squid
|
|
66
|
-
- [Space Huggers - JS13K Edition](https://github.com/KilledByAPixel/SpaceHuggers) - Original js13k game with source code
|
|
67
|
-
- [Isletopia](https://store.steampowered.com/app/1861260/Isletopia) - Relaxing strategy game of greenifying barren islands
|
|
68
|
-
- [Dead Again](https://js13kgames.com/entries/dead-again) - Top down survial horror by [sanojian & repsej](https://github.com/sanojian/js13k_2022)
|
|
69
|
-
- [Hel's Trial](https://js13kgames.com/entries/hels-trial) - Turn based RPG by [Sebastian Dorn](https://github.com/sebadorn/js13k-2022-death)
|
|
70
|
-
- [Bit Butcher](https://js13kgames.com/entries/bit-butcher) - Survival crafting game by [Deathray Games](https://github.com/deathraygames/bit-butcher)
|
|
71
|
-
- [Necrotic Commander](https://js13kgames.com/entries/necrotic-commander) - Tower defense game by [Daniel Jeffery](https://github.com/d-jeffery/NecroticCommander)
|
|
72
|
-
- [Boxing up Bamboo](https://patrickgh3.itch.io/boxing-up-bamboo) - A challenging puzzle game by [Patrick Traynor](https://cwpat.me/about)
|
|
73
|
-
- Send me your games!
|
|
74
|
-
|
|
75
|
-

|