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.
@@ -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.updateWebGL(GameLevel.foregroundTileLayer);
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
- GameLevel.updateWebGL(layer);
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
- updateWebGL(tileLayers[layer]);
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 = keyDirection().x || mouseIsDown(0);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "littlejsengine",
3
- "version": "1.14.8",
3
+ "version": "1.14.9",
4
4
  "description": "LittleJS - Tiny and Fast HTML5 Game Engine",
5
5
  "main": "dist/littlejs.esm.js",
6
6
  "types": "dist/littlejs.d.ts",
@@ -316,7 +316,8 @@ class UIObject
316
316
  }
317
317
  }
318
318
  }
319
- if (isActive && (!mouseDown || !this.isHoverObject()))
319
+ if (isActive)
320
+ if (!mouseDown || (this.dragActivate && !this.isHoverObject()))
320
321
  {
321
322
  this.onRelease();
322
323
  if (this.soundRelease)
package/src/engine.js CHANGED
@@ -30,7 +30,7 @@ const engineName = 'LittleJS';
30
30
  * @type {string}
31
31
  * @default
32
32
  * @memberof Engine */
33
- const engineVersion = '1.14.8';
33
+ const engineVersion = '1.14.9';
34
34
 
35
35
  /** Frames per second to update
36
36
  * @type {number}