littlejsengine 1.14.8 → 1.14.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/dist/littlejs.esm.js +3 -2
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +3 -2
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +3 -2
- package/examples/platformer/gameEffects.js +6 -2
- package/examples/platformer/gameLevel.js +1 -7
- package/examples/shorts/box2dCar.js +2 -1
- package/package.json +1 -1
- package/plugins/uiSystem.js +2 -1
- package/src/engine.js +1 -1
|
@@ -36,7 +36,11 @@ export const persistentParticleDestroyCallback = (particle)=>
|
|
|
36
36
|
// copy particle to tile layer on death
|
|
37
37
|
LJS.ASSERT(!particle.tileInfo, 'quick draw to tile layer uses canvas 2d so must be untextured');
|
|
38
38
|
if (particle.groundObject)
|
|
39
|
+
{
|
|
39
40
|
GameLevel.foregroundTileLayer.drawTile(particle.pos, particle.size, particle.tileInfo, particle.color, particle.angle, particle.mirror);
|
|
41
|
+
// update WebGL texture
|
|
42
|
+
GameLevel.foregroundTileLayer.useWebGL();
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export function makeBlood(pos, amount) { makeDebris(pos, hsl(0,1,.5), amount, .1, 0); }
|
|
@@ -83,7 +87,7 @@ export function explosion(pos, radius=3)
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
// update WebGL texture
|
|
86
|
-
GameLevel.
|
|
90
|
+
GameLevel.foregroundTileLayer.useWebGL();
|
|
87
91
|
|
|
88
92
|
// kill/push objects
|
|
89
93
|
LJS.engineObjectsCallback(pos, radius*3, (o)=>
|
|
@@ -159,7 +163,7 @@ export function destroyTile(pos, makeSound = 1, cleanup = 1)
|
|
|
159
163
|
for (let i=-1;i<=1;++i)
|
|
160
164
|
for (let j=-1;j<=1;++j)
|
|
161
165
|
GameLevel.decorateTile(pos.add(vec2(i,j)));
|
|
162
|
-
|
|
166
|
+
layer.useWebGL();
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
return true;
|
|
@@ -14,7 +14,6 @@ import * as GameEffects from './gameEffects.js';
|
|
|
14
14
|
import * as Game from './game.js';
|
|
15
15
|
const {vec2, hsl, tile} = LJS;
|
|
16
16
|
|
|
17
|
-
export const useWebGLTileLayers = true;
|
|
18
17
|
export const tileType_ladder = -1;
|
|
19
18
|
export const tileType_empty = 0;
|
|
20
19
|
export const tileType_solid = 1;
|
|
@@ -138,7 +137,7 @@ function loadLevelData()
|
|
|
138
137
|
for (pos.x=levelSize.x; pos.x--;)
|
|
139
138
|
for (pos.y=levelSize.y; pos.y--;)
|
|
140
139
|
decorateTile(pos, layer);
|
|
141
|
-
|
|
140
|
+
tileLayers[layer].useWebGL();
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
|
|
@@ -204,9 +203,4 @@ export function getCameraTarget()
|
|
|
204
203
|
// camera is above player
|
|
205
204
|
const offset = 100/LJS.cameraScale*LJS.percent(LJS.mainCanvasSize.y, 300, 600);
|
|
206
205
|
return Game.player.pos.add(vec2(0, offset));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function updateWebGL(layer)
|
|
210
|
-
{
|
|
211
|
-
layer.useWebGL(useWebGLTileLayers);
|
|
212
206
|
}
|
|
@@ -38,7 +38,8 @@ class CarObject extends Box2dObject
|
|
|
38
38
|
|
|
39
39
|
// car controls - use mouse, arrow keys, or A/D to drive
|
|
40
40
|
const maxSpeed = 40;
|
|
41
|
-
const input =
|
|
41
|
+
const input = mouseIsDown(0) ? 1 :
|
|
42
|
+
mouseIsDown(2) ? -1 : keyDirection().x ;
|
|
42
43
|
let s = this.wheels[0].motorJoint.getMotorSpeed();
|
|
43
44
|
s = input ? clamp(s - input, -maxSpeed, maxSpeed) : 0;
|
|
44
45
|
this.wheels[0].motorJoint.setMotorSpeed(s);
|
package/package.json
CHANGED
package/plugins/uiSystem.js
CHANGED