littlejsengine 1.1.26 → 1.2.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.
Files changed (40) hide show
  1. package/README.md +7 -9
  2. package/build.bat +1 -1
  3. package/engine/engine.all.js +369 -377
  4. package/engine/engine.all.min.js +1 -1
  5. package/engine/engine.all.release.js +338 -147
  6. package/engine/engine.js +7 -7
  7. package/engine/engineAudio.js +2 -2
  8. package/engine/engineBuild.bat +9 -1
  9. package/engine/engineDebug.js +32 -231
  10. package/engine/engineDraw.js +130 -20
  11. package/engine/engineFont.png +0 -0
  12. package/engine/engineInput.js +32 -9
  13. package/engine/engineMedals.js +7 -4
  14. package/engine/engineObject.js +30 -11
  15. package/engine/engineParticles.js +5 -3
  16. package/engine/engineSettings.js +5 -0
  17. package/engine/engineTileLayer.js +17 -14
  18. package/engine/engineUtilities.js +50 -18
  19. package/engine/engineWebGL.js +53 -59
  20. package/engine/index.d.ts +1644 -0
  21. package/examples/breakout/game.js +9 -7
  22. package/examples/breakout/gameObjects.js +3 -3
  23. package/examples/breakout/index.html +3 -3
  24. package/examples/particles/index.html +366 -0
  25. package/examples/particles/tiles.png +0 -0
  26. package/examples/platformer/game.js +5 -5
  27. package/examples/platformer/gameEffects.js +10 -10
  28. package/examples/platformer/gameLevel.js +3 -3
  29. package/examples/platformer/gameObjects.js +3 -3
  30. package/examples/platformer/gamePlayer.js +11 -6
  31. package/examples/platformer/index.html +6 -6
  32. package/examples/platformer/tiles.png +0 -0
  33. package/examples/puzzle/game.js +3 -3
  34. package/examples/puzzle/index.html +2 -2
  35. package/examples/screenshot.jpg +0 -0
  36. package/examples/stress/index.html +4 -4
  37. package/game.js +4 -7
  38. package/index.html +13 -13
  39. package/package.json +8 -1
  40. package/engine/engineBuildSetup.bat +0 -6
@@ -43,7 +43,7 @@ function gameInit()
43
43
  {
44
44
  // setup canvas
45
45
  canvasFixedSize = vec2(1920, 1080); // 1080p
46
- mainCanvas.style.background = backgroundColor.rgba();
46
+ mainCanvas.style.background = backgroundColor;
47
47
 
48
48
  // load high score
49
49
  bestScore = localStorage[highScoreKey] || 0;
@@ -100,7 +100,7 @@ function gameUpdate()
100
100
 
101
101
  if (keepFalling)
102
102
  {
103
- const p = percent(comboCount, 0, 9);
103
+ const p = percent(comboCount, 9, 0);
104
104
  fallTimer.set(fallTime*p);
105
105
  sound_fall.play();
106
106
  }
@@ -284,7 +284,7 @@ function clearMatches()
284
284
  const color1 = tileColors[data];
285
285
  const color2 = color1.lerp(new Color, .5);
286
286
  new ParticleEmitter(
287
- pos.add(vec2(.5)), 1, .1, 100, PI, // pos, emitSize, emitTime, emitRate, emiteCone
287
+ pos.add(vec2(.5)), 0, 1, .1, 100, PI,// pos, angle, emitSize, emitTime, emitRate, emiteCone
288
288
  undefined, undefined, // tileIndex, tileSize
289
289
  color1, color2, // colorStartA, colorStartB
290
290
  color1.scale(1,0), color2.scale(1,0),// colorEndA, colorEndB
@@ -5,5 +5,5 @@
5
5
  <link rel=icon type=image/png href=../../favicon.png>
6
6
  </head><body>
7
7
 
8
- <script src=../../engine/engine.all.js?92></script>
9
- <script src=game.js?92></script>
8
+ <script src=../../engine/engine.all.js?104></script>
9
+ <script src=game.js?104></script>
Binary file
@@ -5,7 +5,7 @@
5
5
  <link rel=icon type=image/png href=../../favicon.png>
6
6
  </head><body>
7
7
 
8
- <script src=../../engine/engine.all.min.js?92></script>
8
+ <script src=../../engine/engine.all.min.js?104></script>
9
9
  <script>
10
10
 
11
11
  /*
@@ -54,7 +54,7 @@ function gameInit()
54
54
 
55
55
  // display stats using a div so when using glOverlay it still appears on top
56
56
  document.body.appendChild(statsDisplay = document.createElement('div'));
57
- statsDisplay.style = 'position:absolute;width:100%;top:50%;left:50%;transform:translate(-50%,-50%);font-size:4em;text-align:center;font-family:arial;user-select:none';
57
+ statsDisplay.style = 'position:absolute;width:100%;top:50%;left:50%;transform:translate(-50%,-50%);font-size:6em;text-align:center;font-family:arial;user-select:none';
58
58
  }
59
59
 
60
60
  ///////////////////////////////////////////////////////////////////////////////
@@ -83,7 +83,7 @@ function gameUpdate()
83
83
  });
84
84
 
85
85
  // mouse wheel = zoom
86
- cameraScale = clamp(cameraScale*(1-mouseWheel/10), 1e3, 1);
86
+ cameraScale = clamp(cameraScale*(1-mouseWheel/10), 1, 1e3);
87
87
  }
88
88
 
89
89
  ///////////////////////////////////////////////////////////////////////////////
@@ -96,7 +96,7 @@ function gameRender()
96
96
  {
97
97
  // track fps and update stats
98
98
  const frameTimeMS = Date.now();
99
- showFPS = lerp(.05, 1e3/(frameTimeMS - timeMS||1), showFPS);
99
+ showFPS = lerp(.05, showFPS, 1e3/(frameTimeMS - timeMS||1));
100
100
  timeMS = frameTimeMS;
101
101
 
102
102
  const spriteCount = sprites.length
package/game.js CHANGED
@@ -16,7 +16,6 @@ const sound_click = new Sound([.5,.5]);
16
16
 
17
17
  // medals
18
18
  const medal_example = new Medal(0, 'Example Medal', 'Medal description goes here.');
19
- const medal_tenClicks = new Medal(1, 'Ten Clicks!', 'You have clicked 10 times.', '🖱️');
20
19
  medalsInit('Hello World');
21
20
 
22
21
  ///////////////////////////////////////////////////////////////////////////////
@@ -58,12 +57,12 @@ function gameInit()
58
57
  // create particle emitter
59
58
  const center = tileCollisionSize.scale(.5).add(vec2(0,9));
60
59
  particleEmiter = new ParticleEmitter(
61
- center, 1, 0, 500, PI, // pos, emitSize, emitTime, emitRate, emiteCone
60
+ center, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
62
61
  0, vec2(16), // tileIndex, tileSize
63
- new Color, new Color(0,0,0), // colorStartA, colorStartB
62
+ new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
64
63
  new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
65
- 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
66
- .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
64
+ 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
65
+ .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
67
66
  .5, 1, 1 // randomness, collide, additive, randomColorLinear, renderOrder
68
67
  );
69
68
  particleEmiter.elasticity = .3;
@@ -86,8 +85,6 @@ function gameUpdate()
86
85
 
87
86
  // unlock medals
88
87
  medal_example.unlock();
89
- if (++clickCount == 10)
90
- medal_tenClicks.unlock();
91
88
  }
92
89
 
93
90
  // move particles to mouse location if on screen
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?92></script>
10
- <script src=engine/engineUtilities.js?92></script>
11
- <script src=engine/engineSettings.js?92></script>
12
- <script src=engine/engineObject.js?92></script>
13
- <script src=engine/engineDraw.js?92></script>
14
- <script src=engine/engineInput.js?92></script>
15
- <script src=engine/engineAudio.js?92></script>
16
- <script src=engine/engineTileLayer.js?92></script>
17
- <script src=engine/engineParticles.js?92></script>
18
- <script src=engine/engineMedals.js?92></script>
19
- <script src=engine/engineWebGL.js?92></script>
20
- <script src=engine/engine.js?92></script>
9
+ <script src=engine/engineDebug.js?105></script>
10
+ <script src=engine/engineUtilities.js?105></script>
11
+ <script src=engine/engineSettings.js?105></script>
12
+ <script src=engine/engineObject.js?105></script>
13
+ <script src=engine/engineDraw.js?105></script>
14
+ <script src=engine/engineInput.js?105></script>
15
+ <script src=engine/engineAudio.js?105></script>
16
+ <script src=engine/engineTileLayer.js?105></script>
17
+ <script src=engine/engineParticles.js?105></script>
18
+ <script src=engine/engineMedals.js?105></script>
19
+ <script src=engine/engineWebGL.js?105></script>
20
+ <script src=engine/engine.js?105></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?92></script>
26
+ <script src=game.js?105></script>
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "littlejsengine",
3
- "version": "1.1.26",
3
+ "version": "1.2.9",
4
4
  "description": "LittleJS - Tiny and Fast HTML5 Game Engine",
5
5
  "main": "engine/engine.all.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/KilledByAPixel/LittleJS.git"
9
9
  },
10
+ "dependencies": {
11
+ "google-closure-compiler": "^20220502.0.0",
12
+ "uglify-js": "^3.15.5",
13
+ "roadroller": "^2.1.0",
14
+ "ect-bin": "^1.4.1",
15
+ "typescript": "^4.7.2"
16
+ },
10
17
  "keywords": [
11
18
  "HTML5",
12
19
  "JavaScript",
@@ -1,6 +0,0 @@
1
- rem Install these tools to build LittleJS
2
-
3
- call npm install -g google-closure-compiler
4
- call npm install -g uglify-js
5
- call npm install -g roadroller
6
- call npm install -g ect-bin