littlejsengine 1.14.10 → 1.14.16
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/dist/littlejs.d.ts +264 -120
- package/dist/littlejs.esm.js +603 -288
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +600 -287
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +521 -232
- package/examples/box2d/gameObjects.js +2 -2
- package/examples/breakout/gameObjects.js +2 -2
- package/examples/breakoutTutorial/README.md +32 -32
- package/examples/breakoutTutorial/game.js +1 -1
- package/examples/electron/game.js +3 -3
- package/examples/electron/index.html +2 -2
- package/examples/electron/package.json +1 -8
- package/examples/index.html +59 -51
- package/examples/module/game.js +3 -3
- package/examples/platformer/gameCharacter.js +6 -2
- package/examples/platformer/gameEffects.js +4 -4
- package/examples/platformer/gameLevel.js +1 -1
- package/examples/platformer/gameObjects.js +11 -9
- package/examples/puzzle/game.js +1 -1
- package/examples/shorts/animation.js +1 -1
- package/examples/shorts/base.html +1 -1
- package/examples/shorts/blending.js +8 -14
- package/examples/shorts/box2d.js +7 -3
- package/examples/shorts/box2dCar.js +2 -1
- package/examples/shorts/empty.js +30 -0
- package/examples/shorts/helloWorld.js +1 -1
- package/examples/shorts/hillGlideGame.js +10 -4
- package/examples/shorts/landerGame.js +30 -3
- package/examples/shorts/medals.js +4 -4
- package/examples/shorts/music.js +29 -55
- package/examples/shorts/musicPlayer.js +134 -0
- package/examples/shorts/nineSlice.js +34 -15
- package/examples/shorts/parallax.js +4 -3
- package/examples/shorts/particles.js +16 -16
- package/examples/shorts/piano.js +15 -21
- package/examples/shorts/pongGame.js +6 -4
- package/examples/shorts/raycasting.js +13 -5
- package/examples/shorts/sequencer.js +122 -0
- package/examples/shorts/shapes.js +7 -4
- package/examples/shorts/slidingPuzzle.js +16 -6
- package/examples/shorts/sound.js +18 -9
- package/examples/shorts/spaceGame.js +12 -8
- package/examples/shorts/spriteAtlas.js +7 -7
- package/examples/shorts/starfield.js +1 -1
- package/examples/shorts/systemFont.js +2 -2
- package/examples/shorts/texture.js +2 -2
- package/examples/shorts/tileLayer.js +10 -10
- package/examples/shorts/tiltedView.js +14 -3
- package/examples/shorts/timers.js +10 -0
- package/examples/shorts/topDown.js +4 -1
- package/examples/shorts/uiSystem.js +8 -5
- package/examples/starter/game.js +3 -3
- package/examples/starter/index.html +2 -2
- package/examples/typescript/game.js +3 -3
- package/examples/typescript/game.ts +3 -3
- package/examples/uiSystem/game.js +6 -6
- package/package.json +4 -2
- package/plugins/box2d.js +18 -3
- package/plugins/newgrounds.js +11 -9
- package/plugins/postProcess.js +5 -2
- package/plugins/uiSystem.js +120 -34
- package/plugins/zzfxm.js +5 -1
- package/reference.md +1 -3
- package/src/engine.js +52 -21
- package/src/engineAudio.js +31 -14
- package/src/engineDebug.js +80 -55
- package/src/engineDraw.js +60 -31
- package/src/engineExport.js +3 -1
- package/src/engineMedals.js +10 -2
- package/src/engineObject.js +14 -10
- package/src/engineParticles.js +59 -46
- package/src/engineRelease.js +1 -0
- package/src/engineSettings.js +7 -7
- package/src/engineTileLayer.js +49 -18
- package/src/engineUtilities.js +79 -34
|
@@ -2,12 +2,13 @@ function gameInit()
|
|
|
2
2
|
{
|
|
3
3
|
// setup ui system plugin
|
|
4
4
|
new UISystemPlugin;
|
|
5
|
-
uiSystem.defaultSoundPress = new Sound([
|
|
6
|
-
uiSystem.defaultSoundClick = new Sound([
|
|
5
|
+
uiSystem.defaultSoundPress = new Sound([.5,0,220]);
|
|
6
|
+
uiSystem.defaultSoundClick = new Sound([.5,0,440]);
|
|
7
7
|
uiSystem.defaultCornerRadius = 8;
|
|
8
8
|
|
|
9
9
|
// example button that returns to menu
|
|
10
|
-
const buttonBack = new UIButton(mainCanvasSize.scale(.5), vec2(200),
|
|
10
|
+
const buttonBack = new UIButton(mainCanvasSize.scale(.5), vec2(200),
|
|
11
|
+
'Back\nto\nMenu');
|
|
11
12
|
buttonBack.textHeight = 60;
|
|
12
13
|
buttonBack.onClick = ()=> uiMenu.visible = true;
|
|
13
14
|
|
|
@@ -16,7 +17,8 @@ function gameInit()
|
|
|
16
17
|
canvasClearColor = hsl(0,0,.8);
|
|
17
18
|
|
|
18
19
|
// example text
|
|
19
|
-
uiMenu.addChild(new UIText(vec2(-80,-120), vec2(500, 80),
|
|
20
|
+
uiMenu.addChild(new UIText(vec2(-80,-120), vec2(500, 80),
|
|
21
|
+
'LittleJS UI\nSystem Demo'));
|
|
20
22
|
|
|
21
23
|
// example image
|
|
22
24
|
uiMenu.addChild(new UITile(vec2(200,-140), vec2(128), tile(3, 128)));
|
|
@@ -33,7 +35,8 @@ function gameInit()
|
|
|
33
35
|
uiMenu.addChild(checkbox);
|
|
34
36
|
|
|
35
37
|
// example scrollbar
|
|
36
|
-
const scrollbar = new UIScrollbar(vec2(0,90), vec2(300, 50), soundVolume,
|
|
38
|
+
const scrollbar = new UIScrollbar(vec2(0,90), vec2(300, 50), soundVolume,
|
|
39
|
+
'Volume');
|
|
37
40
|
uiMenu.addChild(scrollbar);
|
|
38
41
|
scrollbar.onChange = ()=> setSoundVolume(scrollbar.value);
|
|
39
42
|
|
package/examples/starter/game.js
CHANGED
|
@@ -65,7 +65,7 @@ function gameInit()
|
|
|
65
65
|
// create particle emitter
|
|
66
66
|
particleEmitter = new ParticleEmitter(
|
|
67
67
|
vec2(16,9), 0, // emitPos, emitAngle
|
|
68
|
-
0, 0, 500, PI, // emitSize, emitTime,
|
|
68
|
+
0, 0, 500, PI, // emitSize, emitTime, rate, cone
|
|
69
69
|
tile(0, 16), // tileIndex, tileSize
|
|
70
70
|
hsl(1,1,1), hsl(0,0,0), // colorStartA, colorStartB
|
|
71
71
|
hsl(0,0,0,0), hsl(0,0,0,0), // colorEndA, colorEndB
|
|
@@ -74,7 +74,7 @@ function gameInit()
|
|
|
74
74
|
.05, .5, true, true // fadeRate, randomness, collide, additive
|
|
75
75
|
);
|
|
76
76
|
particleEmitter.restitution = .3; // bounce when it collides
|
|
77
|
-
particleEmitter.trailScale = 2; // stretch
|
|
77
|
+
particleEmitter.trailScale = 2; // stretch as it moves
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -86,7 +86,7 @@ function gameUpdate()
|
|
|
86
86
|
sound_click.play(mousePos);
|
|
87
87
|
|
|
88
88
|
// change particle color and set to fade out
|
|
89
|
-
particleEmitter.colorStartA =
|
|
89
|
+
particleEmitter.colorStartA = randColor();
|
|
90
90
|
particleEmitter.colorStartB = randColor();
|
|
91
91
|
particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1,0);
|
|
92
92
|
particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1,0);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</head><body>
|
|
8
8
|
|
|
9
9
|
<!-- LittleJS Engine -->
|
|
10
|
-
<script src=../../dist/littlejs.js?
|
|
10
|
+
<script src=../../dist/littlejs.js?11416></script>
|
|
11
11
|
|
|
12
12
|
<!-- LittleJS Engine Source
|
|
13
13
|
<script src=../../src/engineDebug.js></script>
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
-->
|
|
32
32
|
|
|
33
33
|
<!-- Add your game scripts here -->
|
|
34
|
-
<script src=game.js?
|
|
34
|
+
<script src=game.js?11416></script>
|
|
@@ -52,7 +52,7 @@ function gameInit() {
|
|
|
52
52
|
LJS.setGravity(vec2(0, -.01));
|
|
53
53
|
// create particle emitter
|
|
54
54
|
particleEmitter = new LJS.ParticleEmitter(vec2(16, 9), 0, // emitPos, emitAngle
|
|
55
|
-
1, 0, 500, Math.PI, // emitSize, emitTime,
|
|
55
|
+
1, 0, 500, Math.PI, // emitSize, emitTime, rate, cone
|
|
56
56
|
tile(0, 16), // tileIndex, tileSize
|
|
57
57
|
hsl(1, 1, 1), hsl(0, 0, 0), // colorStartA, colorStartB
|
|
58
58
|
hsl(0, 0, 0, 0), hsl(0, 0, 0, 0), // colorEndA, colorEndB
|
|
@@ -61,7 +61,7 @@ function gameInit() {
|
|
|
61
61
|
.05, .5, true, true // fadeRate, randomness, collide, additive
|
|
62
62
|
);
|
|
63
63
|
particleEmitter.restitution = .3; // bounce when it collides
|
|
64
|
-
particleEmitter.trailScale = 2; // stretch
|
|
64
|
+
particleEmitter.trailScale = 2; // stretch as it moves
|
|
65
65
|
}
|
|
66
66
|
///////////////////////////////////////////////////////////////////////////////
|
|
67
67
|
function gameUpdate() {
|
|
@@ -69,7 +69,7 @@ function gameUpdate() {
|
|
|
69
69
|
// play sound when mouse is pressed
|
|
70
70
|
sound_click.play(LJS.mousePos);
|
|
71
71
|
// change particle color and set to fade out
|
|
72
|
-
particleEmitter.colorStartA =
|
|
72
|
+
particleEmitter.colorStartA = LJS.randColor();
|
|
73
73
|
particleEmitter.colorStartB = LJS.randColor();
|
|
74
74
|
particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1, 0);
|
|
75
75
|
particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1, 0);
|
|
@@ -69,7 +69,7 @@ function gameInit()
|
|
|
69
69
|
// create particle emitter
|
|
70
70
|
particleEmitter = new LJS.ParticleEmitter(
|
|
71
71
|
vec2(16,9), 0, // emitPos, emitAngle
|
|
72
|
-
1, 0, 500, Math.PI, // emitSize, emitTime,
|
|
72
|
+
1, 0, 500, Math.PI, // emitSize, emitTime, rate, cone
|
|
73
73
|
tile(0, 16), // tileIndex, tileSize
|
|
74
74
|
hsl(1,1,1), hsl(0,0,0), // colorStartA, colorStartB
|
|
75
75
|
hsl(0,0,0,0), hsl(0,0,0,0), // colorEndA, colorEndB
|
|
@@ -78,7 +78,7 @@ function gameInit()
|
|
|
78
78
|
.05, .5, true, true // fadeRate, randomness, collide, additive
|
|
79
79
|
);
|
|
80
80
|
particleEmitter.restitution = .3; // bounce when it collides
|
|
81
|
-
particleEmitter.trailScale = 2; // stretch
|
|
81
|
+
particleEmitter.trailScale = 2; // stretch stretch as it moves
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -90,7 +90,7 @@ function gameUpdate()
|
|
|
90
90
|
sound_click.play(LJS.mousePos);
|
|
91
91
|
|
|
92
92
|
// change particle color and set to fade out
|
|
93
|
-
particleEmitter.colorStartA =
|
|
93
|
+
particleEmitter.colorStartA = LJS.randColor();
|
|
94
94
|
particleEmitter.colorStartB = LJS.randColor();
|
|
95
95
|
particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1,0);
|
|
96
96
|
particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1,0);
|
|
@@ -21,8 +21,8 @@ LJS.setCanvasPixelated(false);
|
|
|
21
21
|
|
|
22
22
|
function createUI()
|
|
23
23
|
{
|
|
24
|
-
LJS.uiSystem.defaultSoundPress = new LJS.Sound([
|
|
25
|
-
LJS.uiSystem.defaultSoundClick = new LJS.Sound([
|
|
24
|
+
LJS.uiSystem.defaultSoundPress = new LJS.Sound([.5,0,220]);
|
|
25
|
+
LJS.uiSystem.defaultSoundClick = new LJS.Sound([.5,0,440]);
|
|
26
26
|
LJS.uiSystem.defaultCornerRadius = 8;
|
|
27
27
|
|
|
28
28
|
// setup root to attach all ui elements to
|
|
@@ -41,14 +41,14 @@ function createUI()
|
|
|
41
41
|
uiMenu.addChild(uiBackground);
|
|
42
42
|
|
|
43
43
|
// example large text
|
|
44
|
-
const textTitle = new LJS.UIText(vec2(0,-220), vec2(500,
|
|
44
|
+
const textTitle = new LJS.UIText(vec2(0,-220), vec2(500, 120), 'Test Title');
|
|
45
45
|
uiMenu.addChild(textTitle);
|
|
46
46
|
textTitle.textColor = LJS.RED;
|
|
47
47
|
textTitle.lineWidth = 4;
|
|
48
48
|
textTitle.lineColor = LJS.BLUE;
|
|
49
49
|
|
|
50
50
|
// example multiline text
|
|
51
|
-
const textTest = new LJS.UIText(vec2(-60,-120), vec2(
|
|
51
|
+
const textTest = new LJS.UIText(vec2(-60,-120), vec2(350, 60), 'Test Text\nSecond text line.')
|
|
52
52
|
uiMenu.addChild(textTest);
|
|
53
53
|
|
|
54
54
|
// example tile image
|
|
@@ -63,7 +63,7 @@ function createUI()
|
|
|
63
63
|
// example button
|
|
64
64
|
const button1 = new LJS.UIButton(vec2(0,140), vec2(350, 50), 'Test Button');
|
|
65
65
|
uiMenu.addChild(button1);
|
|
66
|
-
button1.onClick = ()=>
|
|
66
|
+
button1.onClick = ()=> uiBackground.color = hsl(Math.random(),1,.7);
|
|
67
67
|
|
|
68
68
|
// example checkbox
|
|
69
69
|
const checkbox = new LJS.UICheckbox(vec2(-140,-20), vec2(40));
|
|
@@ -71,7 +71,7 @@ function createUI()
|
|
|
71
71
|
checkbox.onChange = ()=> button1.disabled = checkbox.checked;
|
|
72
72
|
|
|
73
73
|
// text attached to checkbox
|
|
74
|
-
const checkboxText = new LJS.UIText(vec2(170,0), vec2(300,
|
|
74
|
+
const checkboxText = new LJS.UIText(vec2(170,0), vec2(300, 60), 'Test Checkbox');
|
|
75
75
|
checkbox.addChild(checkboxText);
|
|
76
76
|
|
|
77
77
|
// exit button
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "littlejsengine",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.16",
|
|
4
4
|
"description": "LittleJS - Tiny and Fast HTML5 Game Engine",
|
|
5
5
|
"main": "dist/littlejs.esm.js",
|
|
6
6
|
"types": "dist/littlejs.d.ts",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"google-closure-compiler": "~20230502.0.0",
|
|
38
38
|
"roadroller": "~2.1.0",
|
|
39
39
|
"typescript": "~5.1.6",
|
|
40
|
-
"uglify-js": "~3.17.4"
|
|
40
|
+
"uglify-js": "~3.17.4",
|
|
41
|
+
"electron": "^38.2.0",
|
|
42
|
+
"electron-packager": "^17.1.2"
|
|
41
43
|
}
|
|
42
44
|
}
|
package/plugins/box2d.js
CHANGED
|
@@ -39,6 +39,7 @@ function box2dSetDebug(enable) { box2dDebug = enable; }
|
|
|
39
39
|
* - Each object has a Box2D body which can have multiple fixtures and joints
|
|
40
40
|
* - Provides interface for Box2D body and fixture functions
|
|
41
41
|
* @extends EngineObject
|
|
42
|
+
* @memberof Box2D
|
|
42
43
|
*/
|
|
43
44
|
class Box2dObject extends EngineObject
|
|
44
45
|
{
|
|
@@ -50,7 +51,7 @@ class Box2dObject extends EngineObject
|
|
|
50
51
|
* @param {Color} [color]
|
|
51
52
|
* @param {number} [bodyType]
|
|
52
53
|
* @param {number} [renderOrder] */
|
|
53
|
-
constructor(pos
|
|
54
|
+
constructor(pos, size, tileInfo, angle=0, color, bodyType=box2d.bodyTypeDynamic, renderOrder=0)
|
|
54
55
|
{
|
|
55
56
|
super(pos, size, tileInfo, angle, color, renderOrder);
|
|
56
57
|
|
|
@@ -64,7 +65,7 @@ class Box2dObject extends EngineObject
|
|
|
64
65
|
this.lineColor = BLACK;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
/** Destroy this object and
|
|
68
|
+
/** Destroy this object and its physics body */
|
|
68
69
|
destroy()
|
|
69
70
|
{
|
|
70
71
|
// destroy physics body, fixtures, and joints
|
|
@@ -548,6 +549,7 @@ class Box2dRaycastResult
|
|
|
548
549
|
* Box2D Joint
|
|
549
550
|
* - Base class for Box2D joints
|
|
550
551
|
* - A joint is used to connect objects together
|
|
552
|
+
* @memberof Box2D
|
|
551
553
|
*/
|
|
552
554
|
class Box2dJoint
|
|
553
555
|
{
|
|
@@ -603,6 +605,7 @@ class Box2dJoint
|
|
|
603
605
|
* - This a soft constraint with a max force
|
|
604
606
|
* - This allows the constraint to stretch and without applying huge forces
|
|
605
607
|
* @extends Box2dJoint
|
|
608
|
+
* @memberof Box2D
|
|
606
609
|
*/
|
|
607
610
|
class Box2dTargetJoint extends Box2dJoint
|
|
608
611
|
{
|
|
@@ -652,6 +655,7 @@ class Box2dTargetJoint extends Box2dJoint
|
|
|
652
655
|
* - Constrains two points on two objects to remain at a fixed distance
|
|
653
656
|
* - You can view this as a massless, rigid rod
|
|
654
657
|
* @extends Box2dJoint
|
|
658
|
+
* @memberof Box2D
|
|
655
659
|
*/
|
|
656
660
|
class Box2dDistanceJoint extends Box2dJoint
|
|
657
661
|
{
|
|
@@ -715,6 +719,7 @@ class Box2dDistanceJoint extends Box2dJoint
|
|
|
715
719
|
* Box2D Pin Joint
|
|
716
720
|
* - Pins two objects together at a point
|
|
717
721
|
* @extends Box2dDistanceJoint
|
|
722
|
+
* @memberof Box2D
|
|
718
723
|
*/
|
|
719
724
|
class Box2dPinJoint extends Box2dDistanceJoint
|
|
720
725
|
{
|
|
@@ -734,6 +739,7 @@ class Box2dPinJoint extends Box2dDistanceJoint
|
|
|
734
739
|
* Box2D Rope Joint
|
|
735
740
|
* - Enforces a maximum distance between two points on two objects
|
|
736
741
|
* @extends Box2dJoint
|
|
742
|
+
* @memberof Box2D
|
|
737
743
|
*/
|
|
738
744
|
class Box2dRopeJoint extends Box2dJoint
|
|
739
745
|
{
|
|
@@ -786,6 +792,7 @@ class Box2dRopeJoint extends Box2dJoint
|
|
|
786
792
|
* - You can use a motor to drive the relative rotation about the shared point
|
|
787
793
|
* - A maximum motor torque is provided so that infinite forces are not generated
|
|
788
794
|
* @extends Box2dJoint
|
|
795
|
+
* @memberof Box2D
|
|
789
796
|
*/
|
|
790
797
|
class Box2dRevoluteJoint extends Box2dJoint
|
|
791
798
|
{
|
|
@@ -887,6 +894,7 @@ class Box2dRevoluteJoint extends Box2dJoint
|
|
|
887
894
|
* - Either joint can be a revolute or prismatic joint
|
|
888
895
|
* - You specify a gear ratio to bind the motions together
|
|
889
896
|
* @extends Box2dJoint
|
|
897
|
+
* @memberof Box2D
|
|
890
898
|
*/
|
|
891
899
|
class Box2dGearJoint extends Box2dJoint
|
|
892
900
|
{
|
|
@@ -935,6 +943,7 @@ class Box2dGearJoint extends Box2dJoint
|
|
|
935
943
|
* - You can use a joint limit to restrict the range of motion
|
|
936
944
|
* - You can use a joint motor to drive the motion or to model joint friction
|
|
937
945
|
* @extends Box2dJoint
|
|
946
|
+
* @memberof Box2D
|
|
938
947
|
*/
|
|
939
948
|
class Box2dPrismaticJoint extends Box2dJoint
|
|
940
949
|
{
|
|
@@ -1044,6 +1053,7 @@ class Box2dPrismaticJoint extends Box2dJoint
|
|
|
1044
1053
|
* - You can use a joint motor to drive the motion or to model joint friction
|
|
1045
1054
|
* - This joint is designed for vehicle suspensions
|
|
1046
1055
|
* @extends Box2dJoint
|
|
1056
|
+
* @memberof Box2D
|
|
1047
1057
|
*/
|
|
1048
1058
|
class Box2dWheelJoint extends Box2dJoint
|
|
1049
1059
|
{
|
|
@@ -1139,6 +1149,7 @@ class Box2dWheelJoint extends Box2dJoint
|
|
|
1139
1149
|
* Box2D Weld Joint
|
|
1140
1150
|
* - Glues two objects together
|
|
1141
1151
|
* @extends Box2dJoint
|
|
1152
|
+
* @memberof Box2D
|
|
1142
1153
|
*/
|
|
1143
1154
|
class Box2dWeldJoint extends Box2dJoint
|
|
1144
1155
|
{
|
|
@@ -1197,6 +1208,7 @@ class Box2dWeldJoint extends Box2dJoint
|
|
|
1197
1208
|
* - Used to apply top-down friction
|
|
1198
1209
|
* - Provides 2D translational friction and angular friction
|
|
1199
1210
|
* @extends Box2dJoint
|
|
1211
|
+
* @memberof Box2D
|
|
1200
1212
|
*/
|
|
1201
1213
|
class Box2dFrictionJoint extends Box2dJoint
|
|
1202
1214
|
{
|
|
@@ -1251,6 +1263,7 @@ class Box2dFrictionJoint extends Box2dJoint
|
|
|
1251
1263
|
* - The pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
|
1252
1264
|
* - The force transmitted is scaled by the ratio
|
|
1253
1265
|
* @extends Box2dJoint
|
|
1266
|
+
* @memberof Box2D
|
|
1254
1267
|
*/
|
|
1255
1268
|
class Box2dPulleyJoint extends Box2dJoint
|
|
1256
1269
|
{
|
|
@@ -1318,6 +1331,7 @@ class Box2dPulleyJoint extends Box2dJoint
|
|
|
1318
1331
|
* - Controls the relative motion between two objects
|
|
1319
1332
|
* - Typical usage is to control the movement of a object with respect to the ground
|
|
1320
1333
|
* @extends Box2dJoint
|
|
1334
|
+
* @memberof Box2D
|
|
1321
1335
|
*/
|
|
1322
1336
|
class Box2dMotorJoint extends Box2dJoint
|
|
1323
1337
|
{
|
|
@@ -1381,6 +1395,7 @@ class Box2dMotorJoint extends Box2dJoint
|
|
|
1381
1395
|
/**
|
|
1382
1396
|
* Box2D Global Object
|
|
1383
1397
|
* - Wraps Box2d world and provides global functions
|
|
1398
|
+
* @memberof Box2D
|
|
1384
1399
|
*/
|
|
1385
1400
|
class Box2dPlugin
|
|
1386
1401
|
{
|
|
@@ -1715,7 +1730,7 @@ async function box2dInit()
|
|
|
1715
1730
|
}
|
|
1716
1731
|
function box2dRender()
|
|
1717
1732
|
{
|
|
1718
|
-
if (box2dDebug || debugPhysics
|
|
1733
|
+
if (box2dDebug || debugPhysics)
|
|
1719
1734
|
box2d.world.DrawDebugData();
|
|
1720
1735
|
}
|
|
1721
1736
|
|
package/plugins/newgrounds.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LittleJS Newgrounds
|
|
2
|
+
* LittleJS Newgrounds Plugin
|
|
3
3
|
* - NewgroundsMedal extends Medal with Newgrounds API functionality
|
|
4
|
-
* - Call new NewgroundsPlugin() to setup Newgrounds
|
|
4
|
+
* - Call new NewgroundsPlugin(app_id) to setup Newgrounds
|
|
5
5
|
* - Uses CryptoJS for encryption if optional cipher is provided
|
|
6
|
+
* - provides functions to interact with medals scoreboards
|
|
6
7
|
* - Keeps connection alive and logs views
|
|
7
|
-
*
|
|
8
|
-
* - Functions to unlock medals
|
|
8
|
+
* @namespace Newgrounds
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
/** Global Newgrounds object
|
|
14
14
|
* @type {NewgroundsPlugin}
|
|
15
|
-
* @memberof
|
|
15
|
+
* @memberof Newgrounds */
|
|
16
16
|
let newgrounds;
|
|
17
17
|
|
|
18
18
|
///////////////////////////////////////////////////////////////////////////////
|
|
19
19
|
/**
|
|
20
20
|
* Newgrounds medal auto unlocks in newgrounds API
|
|
21
21
|
* @extends Medal
|
|
22
|
+
* @memberof Newgrounds
|
|
22
23
|
*/
|
|
23
24
|
class NewgroundsMedal extends Medal
|
|
24
25
|
{
|
|
@@ -43,6 +44,7 @@ class NewgroundsMedal extends Medal
|
|
|
43
44
|
///////////////////////////////////////////////////////////////////////////////
|
|
44
45
|
/**
|
|
45
46
|
* Newgrounds API object
|
|
47
|
+
* @memberof Newgrounds
|
|
46
48
|
*/
|
|
47
49
|
class NewgroundsPlugin
|
|
48
50
|
{
|
|
@@ -76,7 +78,7 @@ class NewgroundsPlugin
|
|
|
76
78
|
// get medals
|
|
77
79
|
const medalsResult = this.call('Medal.getList');
|
|
78
80
|
this.medals = medalsResult ? medalsResult.result.data['medals'] : [];
|
|
79
|
-
debugMedals &&
|
|
81
|
+
debugMedals && LOG(this.medals);
|
|
80
82
|
for (const newgroundsMedal of this.medals)
|
|
81
83
|
{
|
|
82
84
|
const medal = medals[newgroundsMedal['id']];
|
|
@@ -99,7 +101,7 @@ class NewgroundsPlugin
|
|
|
99
101
|
// get scoreboards
|
|
100
102
|
const scoreboardResult = this.call('ScoreBoard.getBoards');
|
|
101
103
|
this.scoreboards = scoreboardResult ? scoreboardResult.result.data.scoreboards : [];
|
|
102
|
-
debugMedals &&
|
|
104
|
+
debugMedals && LOG(this.scoreboards);
|
|
103
105
|
|
|
104
106
|
// keep the session alive with a ping every minute
|
|
105
107
|
const keepAliveMS = 60 * 1e3;
|
|
@@ -168,10 +170,10 @@ class NewgroundsPlugin
|
|
|
168
170
|
try { xmlHttp.send(formData); }
|
|
169
171
|
catch(e)
|
|
170
172
|
{
|
|
171
|
-
debugMedals &&
|
|
173
|
+
debugMedals && LOG('newgrounds call failed', e);
|
|
172
174
|
return;
|
|
173
175
|
}
|
|
174
|
-
debugMedals &&
|
|
176
|
+
debugMedals && LOG(xmlHttp.responseText);
|
|
175
177
|
return xmlHttp.responseText && JSON.parse(xmlHttp.responseText);
|
|
176
178
|
}
|
|
177
179
|
}
|
package/plugins/postProcess.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LittleJS Post Processing Plugin
|
|
3
3
|
* - Supports shadertoy style post processing shaders
|
|
4
|
-
* - call new
|
|
4
|
+
* - call new PostProcessPlugin() to setup post processing
|
|
5
5
|
* - can be enabled to pass other canvases through a final shader
|
|
6
|
+
* @namespace PostProcess
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
'use strict';
|
|
@@ -10,12 +11,14 @@
|
|
|
10
11
|
///////////////////////////////////////////////////////////////////////////////
|
|
11
12
|
|
|
12
13
|
/** Global Post Process plugin object
|
|
13
|
-
* @type {PostProcessPlugin}
|
|
14
|
+
* @type {PostProcessPlugin}
|
|
15
|
+
* @memberof PostProcess */
|
|
14
16
|
let postProcess;
|
|
15
17
|
|
|
16
18
|
/////////////////////////////////////////////////////////////////////////
|
|
17
19
|
/**
|
|
18
20
|
* UI System Global Object
|
|
21
|
+
* @memberof PostProcess
|
|
19
22
|
*/
|
|
20
23
|
class PostProcessPlugin
|
|
21
24
|
{
|