littlejsengine 1.18.4 → 1.18.7

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 (177) hide show
  1. package/COPYRIGHT.txt +38 -0
  2. package/FAQ.md +633 -0
  3. package/README.md +19 -1
  4. package/dist/littlejs.d.ts +349 -54
  5. package/dist/littlejs.esm.js +1469 -448
  6. package/dist/littlejs.esm.min.js +1 -1
  7. package/dist/littlejs.js +1438 -436
  8. package/dist/littlejs.min.js +1 -1
  9. package/dist/littlejs.release.js +1438 -436
  10. package/package.json +8 -1
  11. package/plugins/box2d.js +32 -7
  12. package/{src/engineMedals.js → plugins/medalSystem.js} +248 -196
  13. package/plugins/pathFinder.js +758 -0
  14. package/plugins/pluginExport.js +19 -0
  15. package/plugins/tween.js +1 -1
  16. package/plugins/tweenSystem.js +509 -0
  17. package/plugins/uiSystem.js +150 -11
  18. package/src/engine.js +2 -141
  19. package/src/engineAudio.js +8 -5
  20. package/src/engineBuild.mjs +4 -2
  21. package/src/engineDebug.js +1 -1
  22. package/src/engineDraw.js +21 -3
  23. package/src/engineExport.js +12 -12
  24. package/src/engineInput.js +1 -1
  25. package/src/engineLogo.js +146 -0
  26. package/src/engineMath.js +10 -3
  27. package/src/engineObject.js +11 -5
  28. package/src/engineParticles.js +6 -3
  29. package/src/engineRelease.js +1 -1
  30. package/src/engineSettings.js +0 -47
  31. package/src/engineUtilities.js +7 -2
  32. package/src/engineWebGL.js +34 -7
  33. package/src/jsconfig.json +3 -1
  34. package/.github/workflows/test.yml +0 -17
  35. package/AI.md +0 -173
  36. package/CLAUDE.md +0 -1
  37. package/examples/box2d/game.js +0 -192
  38. package/examples/box2d/gameObjects.js +0 -564
  39. package/examples/box2d/index.html +0 -9
  40. package/examples/box2d/scenes.js +0 -194
  41. package/examples/box2d/tiles.png +0 -0
  42. package/examples/breakout/game.js +0 -175
  43. package/examples/breakout/gameObjects.js +0 -147
  44. package/examples/breakout/index.html +0 -8
  45. package/examples/breakout/tiles.png +0 -0
  46. package/examples/breakoutTutorial/README.md +0 -521
  47. package/examples/breakoutTutorial/game.js +0 -191
  48. package/examples/breakoutTutorial/images/1.png +0 -0
  49. package/examples/breakoutTutorial/images/10.png +0 -0
  50. package/examples/breakoutTutorial/images/11.png +0 -0
  51. package/examples/breakoutTutorial/images/2.png +0 -0
  52. package/examples/breakoutTutorial/images/3.png +0 -0
  53. package/examples/breakoutTutorial/images/4.png +0 -0
  54. package/examples/breakoutTutorial/images/5.png +0 -0
  55. package/examples/breakoutTutorial/images/6.png +0 -0
  56. package/examples/breakoutTutorial/images/7.png +0 -0
  57. package/examples/breakoutTutorial/images/8.png +0 -0
  58. package/examples/breakoutTutorial/images/9.png +0 -0
  59. package/examples/breakoutTutorial/index.html +0 -8
  60. package/examples/electron/build.mjs +0 -127
  61. package/examples/electron/electron.js +0 -35
  62. package/examples/electron/game.js +0 -54
  63. package/examples/electron/index.html +0 -13
  64. package/examples/electron/package.json +0 -5
  65. package/examples/electron/tiles.png +0 -0
  66. package/examples/empty/game.js +0 -51
  67. package/examples/empty/index.html +0 -5
  68. package/examples/empty/tiles.png +0 -0
  69. package/examples/favicon.png +0 -0
  70. package/examples/games.jpg +0 -0
  71. package/examples/htmlMenu/game.js +0 -82
  72. package/examples/htmlMenu/index.html +0 -45
  73. package/examples/htmlMenu/tiles.png +0 -0
  74. package/examples/index.html +0 -62
  75. package/examples/logo.png +0 -0
  76. package/examples/logo2.png +0 -0
  77. package/examples/module/build.mjs +0 -124
  78. package/examples/module/game.js +0 -132
  79. package/examples/module/index.html +0 -10
  80. package/examples/module/tiles.png +0 -0
  81. package/examples/particles/index.html +0 -426
  82. package/examples/particles/tiles.png +0 -0
  83. package/examples/platformer/data/gameLevelData.tmx +0 -143
  84. package/examples/platformer/data/gameLevelData.tsx +0 -4
  85. package/examples/platformer/game.js +0 -147
  86. package/examples/platformer/gameCharacter.js +0 -309
  87. package/examples/platformer/gameEffects.js +0 -278
  88. package/examples/platformer/gameLevel.js +0 -205
  89. package/examples/platformer/gameLevelData.json +0 -171
  90. package/examples/platformer/gameObjects.js +0 -378
  91. package/examples/platformer/gamePlayer.js +0 -35
  92. package/examples/platformer/index.html +0 -9
  93. package/examples/platformer/tiles.png +0 -0
  94. package/examples/platformer/tilesLevel.png +0 -0
  95. package/examples/puzzle/game.js +0 -331
  96. package/examples/puzzle/index.html +0 -8
  97. package/examples/puzzle/tiles.png +0 -0
  98. package/examples/screenshot.jpg +0 -0
  99. package/examples/shorts/animation.js +0 -18
  100. package/examples/shorts/base.html +0 -54
  101. package/examples/shorts/blending.js +0 -14
  102. package/examples/shorts/box2d.js +0 -51
  103. package/examples/shorts/box2dCar.js +0 -59
  104. package/examples/shorts/box2dPool.js +0 -107
  105. package/examples/shorts/box2dTileLayer.js +0 -48
  106. package/examples/shorts/cameraDrag.js +0 -22
  107. package/examples/shorts/clock.js +0 -21
  108. package/examples/shorts/colors.js +0 -25
  109. package/examples/shorts/debugDraw.js +0 -37
  110. package/examples/shorts/empty.js +0 -30
  111. package/examples/shorts/flappyGame.js +0 -55
  112. package/examples/shorts/fontImage.js +0 -17
  113. package/examples/shorts/fps.js +0 -90
  114. package/examples/shorts/helloWorld.js +0 -11
  115. package/examples/shorts/hillGlideGame.js +0 -63
  116. package/examples/shorts/input.js +0 -64
  117. package/examples/shorts/landerGame.js +0 -57
  118. package/examples/shorts/maze.js +0 -48
  119. package/examples/shorts/medals.js +0 -51
  120. package/examples/shorts/music.js +0 -78
  121. package/examples/shorts/musicPlayer.js +0 -137
  122. package/examples/shorts/nineSlice.js +0 -40
  123. package/examples/shorts/parallax.js +0 -72
  124. package/examples/shorts/particles.js +0 -28
  125. package/examples/shorts/piano.js +0 -44
  126. package/examples/shorts/platformer.js +0 -45
  127. package/examples/shorts/pongGame.js +0 -41
  128. package/examples/shorts/postProcess.js +0 -62
  129. package/examples/shorts/sequencer.js +0 -124
  130. package/examples/shorts/shader.js +0 -29
  131. package/examples/shorts/shapes.js +0 -21
  132. package/examples/shorts/slidingPuzzle.js +0 -52
  133. package/examples/shorts/song.mp3 +0 -0
  134. package/examples/shorts/sound.js +0 -36
  135. package/examples/shorts/spaceGame.js +0 -58
  136. package/examples/shorts/spriteAtlas.js +0 -31
  137. package/examples/shorts/starfield.js +0 -15
  138. package/examples/shorts/texture.js +0 -16
  139. package/examples/shorts/textureWrapped.js +0 -12
  140. package/examples/shorts/tileLayer.js +0 -48
  141. package/examples/shorts/tileRaycast.js +0 -39
  142. package/examples/shorts/tiles.png +0 -0
  143. package/examples/shorts/tiltedView.js +0 -63
  144. package/examples/shorts/timers.js +0 -53
  145. package/examples/shorts/topDown.js +0 -38
  146. package/examples/shorts/tween.js +0 -24
  147. package/examples/shorts/uiSystem.js +0 -61
  148. package/examples/shorts/video.webm +0 -0
  149. package/examples/shorts/videoPlayer.js +0 -34
  150. package/examples/shorts.js +0 -743
  151. package/examples/starter/build.bat +0 -7
  152. package/examples/starter/build.mjs +0 -126
  153. package/examples/starter/game.js +0 -137
  154. package/examples/starter/index.html +0 -35
  155. package/examples/starter/tiles.png +0 -0
  156. package/examples/stress/index.html +0 -173
  157. package/examples/style.css +0 -150
  158. package/examples/tweenSystem/game.js +0 -171
  159. package/examples/tweenSystem/index.html +0 -10
  160. package/examples/tweenSystem/tiles.png +0 -0
  161. package/examples/typescript/build.mjs +0 -60
  162. package/examples/typescript/game.js +0 -100
  163. package/examples/typescript/game.ts +0 -132
  164. package/examples/typescript/index.html +0 -10
  165. package/examples/typescript/tiles.png +0 -0
  166. package/examples/typescript/tsconfig.json +0 -17
  167. package/examples/uiSystem/game.js +0 -139
  168. package/examples/uiSystem/index.html +0 -10
  169. package/examples/uiSystem/tiles.png +0 -0
  170. package/jsconfig.json +0 -12
  171. package/plugins/desktop.ini +0 -2
  172. package/reference.md +0 -448
  173. package/test/math.test.mjs +0 -774
  174. package/test/setup.mjs +0 -22
  175. package/test/smoke.test.mjs +0 -274
  176. package/test/tween.test.mjs +0 -576
  177. package/test/util.test.mjs +0 -80
@@ -1,426 +0,0 @@
1
- <!DOCTYPE html><head>
2
- <title>LittleJS Particle System Designer</title>
3
- <meta charset=utf-8>
4
- <meta name=apple-mobile-web-app-capable content=yes>
5
- <meta name=mobile-web-app-capable content=yes>
6
- <link rel=icon type=image/png href=../favicon.png>
7
- <style>
8
- input { width:99px; }
9
- button { margin:1px; }
10
- body { color:#fff; }
11
- #div_emitterSettings
12
- {
13
- position:absolute;
14
- z-index: 1;
15
- height: 100vh;
16
- overflow:auto;
17
- padding:5px;
18
- font-family:sans-serif;
19
- column-count: 2;
20
- column-fill: auto;
21
- }
22
- </style>
23
- </head><body>
24
- <div id=div_emitterSettings></div>
25
- <script type=module>
26
-
27
- // import LittleJS module
28
- import * as LJS from '../../dist/littlejs.esm.js';
29
- const {vec2} = LJS;
30
-
31
- 'use strict';
32
-
33
- // fix texture bleeding by shrinking tiles slightly
34
- LJS.setTileDefaultBleed(.5);
35
-
36
- // allow html input controls
37
- LJS.setInputPreventDefault(false);
38
-
39
- let particleEditor = 0, particleSystem, particleSystemDiv, particleSystemCode;
40
- let inputExpand;
41
- let restartTimer = new LJS.Timer();
42
- const storagePrefix = 'particles_';
43
-
44
- const particleSettings = [];
45
- function addSetting(name, type, min, max, step, description)
46
- {
47
- particleSettings.push({name, type:type||'number', min, max, step, description});
48
- }
49
-
50
- addSetting('emitSize', '', 0, 1e9, .1, 'World space size of the emitter');
51
- addSetting('emitTime', '', 0, 1e9, .1, 'How long to stay alive (0 is forever)');
52
- addSetting('emitRate', '', 0, 1e9, 1, 'How many particles per second to spawn, does not emit if 0');
53
- addSetting('emitConeAngle', '', 0, 1e9, .01,'Local angle to apply velocity to particles from emitter');
54
- addSetting('tileIndex', '', -1, 1e9, 1, 'Tile to use to render object (-1 is untextured)');
55
- addSetting('tileSize', '', 0, 1e9, 1, 'Size of texture tile in source pixels');
56
- addSetting('colorStartA', 'color',0,0,0, 'Color at start of life 1');
57
- addSetting('colorStartA_alpha', 'alpha', 0, 1, .01, 'Alpha at start of life 1');
58
- addSetting('colorStartB', 'color',0,0,0, 'Color at start of life 2');
59
- addSetting('colorStartB_alpha', 'alpha', 0, 1, .01, 'Alpha at start of life 2');
60
- addSetting('colorEndA', 'color',0,0,0, 'Color at end of life 1');
61
- addSetting('colorEndA_alpha', 'alpha', 0, 1, .01, 'Alpha at end of life 1');
62
- addSetting('colorEndB', 'color',0,0,0, 'Color at end of life 2');
63
- addSetting('colorEndB_alpha', 'alpha', 0, 1, .01, 'Alpha at end of life 2');
64
- addSetting('particleTime', '', 0, 1e9, .1, 'How long particles live');
65
- addSetting('sizeStart', '', 0, 1e9, .01,'How big are particles at start');
66
- addSetting('sizeEnd', '', 0, 1e9, .01,'How big are particles at end');
67
- addSetting('speed', '', 0, 1e9, .01,'How fast are particles when spawned');
68
- addSetting('angleSpeed', '', 0, 1e9, .01,'How fast are particles rotating');
69
- addSetting('damping', '', 0, 1, .01,'How much to dampen particle speed');
70
- addSetting('angleDamping', '', 0, 1, .01,'How much to dampen particle angular speed');
71
- addSetting('gravityScale', '', -1e9, 1e9, .1, 'How much does gravity effect particles');
72
- addSetting('particleConeAngle','', 0, 1e9, .1, 'Cone for start particle angle');
73
- addSetting('fadeRate', '', 0, 1, .01,'How quickly particles fade in percent of life');
74
- addSetting('randomness', '', 0, 1, .01,'Apply extra randomness percent');
75
- addSetting('additive', 'checkbox',0,0,0, 'Should particles use additive blend?');
76
- addSetting('randomColorLinear','checkbox',0,0,0, 'Should color be randomized linearly?');
77
-
78
- function makeEmitter()
79
- {
80
- if (particleSystem)
81
- particleSystem.destroy();
82
- particleSystem = new LJS.ParticleEmitter(LJS.cameraPos);
83
- particleSystem.tileInfo = LJS.tile();
84
- particleSystem.emitConeAngle =
85
- particleSystem.particleConeAngle = 3.14;
86
- }
87
-
88
- ///////////////////////////////////////////////////////////////////////////////
89
- function gameInit()
90
- {
91
- makeEmitter();
92
- LJS.setGravity(vec2(0,-.01));
93
- LJS.setCameraScale(64);
94
-
95
- const div = div_emitterSettings;
96
- const title = document.createElement('span')
97
- title.innerText = 'LittleJS Particle Tool';
98
- title.style = 'font-size:20px;font-weight:bold;';
99
- div.appendChild(title);
100
-
101
- for (const setting of particleSettings)
102
- {
103
- // get default value
104
- // todo: clean this up
105
- let defaultValue = '';
106
- {
107
- const name = setting.name;
108
- const type = setting.type;
109
-
110
- if (type == 'color')
111
- {
112
- const color = particleSystem[name];
113
- defaultValue = color.toString(false);
114
- }
115
- else if (type == 'alpha')
116
- {
117
- if (name == 'colorStartA_alpha')
118
- defaultValue = particleSystem.colorStartA.a;
119
- else if (name == 'colorStartB_alpha')
120
- defaultValue = particleSystem.colorStartB.a;
121
- else if (name == 'colorEndA_alpha')
122
- defaultValue = particleSystem.colorEndA.a;
123
- else if (name == 'colorEndB_alpha')
124
- defaultValue = particleSystem.colorEndB.a;
125
- }
126
- else if (name == 'tileSize')
127
- defaultValue = particleSystem.tileInfo.size.x;
128
- else if (type == 'checkbox')
129
- defaultValue = particleSystem[name];
130
- else
131
- defaultValue = particleSystem[name] || '0';
132
- }
133
-
134
- div.appendChild(document.createElement('br'));
135
-
136
- const input = setting.input = document.createElement('input');
137
- const name = setting.name;
138
- input.type = setting.type == 'alpha' ? 'number' : setting.type;
139
- input.title = setting.description;
140
- input.oninput = (e)=> updateParticles(setting.type == 'checkbox');
141
- input.onblur = (e)=> updateParticles(1);
142
- if (setting.min !== undefined)
143
- input.min = setting.min;
144
- if (setting.max !== undefined)
145
- input.max = setting.max;
146
- if (setting.step !== undefined)
147
- input.step = setting.step;
148
- if (name == 'emitConeAngle' || name == 'particleConeAngle')
149
- particleSystem[name] = 3.14; // simplify pi
150
-
151
- const inputReset = document.createElement('button');
152
- inputReset.innerText = '♻️';
153
- inputReset.onclick = (e)=>
154
- {
155
- setting.type == 'checkbox'?
156
- setting.input.checked = defaultValue :
157
- setting.input.value = defaultValue;
158
- updateParticles(1);
159
- }
160
- div.appendChild(inputReset);
161
-
162
- div.appendChild(input);
163
- div.appendChild(document.createTextNode(' ' + name));
164
- }
165
-
166
- div.appendChild(document.createElement('br'));
167
- div.appendChild(document.createElement('br'));
168
-
169
- {
170
- const button = document.createElement('button')
171
- div.appendChild(button);
172
- button.innerHTML = 'Copy To Clipboard';
173
- button.onclick = (e)=> navigator.clipboard.writeText(particleSystemCode.value);
174
- }
175
- {
176
- const button = document.createElement('button');
177
- div.appendChild(button);
178
- button.innerHTML = 'Reset';
179
- button.onclick = (e)=>
180
- {
181
- if (!confirm('Reset to default?'))
182
- return;
183
- makeEmitter();
184
- updateInputs();
185
- LJS.setCameraScale(50);
186
- }
187
- }
188
- {
189
- inputExpand = document.createElement('input');
190
- div.appendChild(inputExpand);
191
- inputExpand.type = 'checkbox';
192
- inputExpand.style.width = 'initial';
193
- inputExpand.oninput = (e)=> updateParticles(1);
194
- div.appendChild(document.createTextNode(' Expand'));
195
- }
196
-
197
- //div.appendChild(document.createTextNode('JavaScript Code... '));
198
- div.appendChild(document.createElement('br'));
199
- div.appendChild(particleSystemCode = document.createElement('textarea'));
200
- particleSystemCode.style.width = '300px';
201
- particleSystemCode.style.height = '100px';
202
- particleSystemCode.disabled = true;
203
-
204
- updateInputs(0);
205
-
206
- // load from storage
207
- for (const setting of particleSettings)
208
- {
209
- const type = setting.type;
210
- const storageName = storagePrefix + setting.name;
211
- const savedValue = localStorage[storageName];
212
- if (savedValue == undefined)
213
- continue;
214
-
215
- if (type == 'checkbox')
216
- setting.input.checked = savedValue == 'true';
217
- else
218
- setting.input.value = savedValue;
219
- }
220
-
221
- updateParticles();
222
- particleSystemCode.value = getCode();
223
- }
224
-
225
- function updateParticles(shouldUpdateInput)
226
- {
227
- for (const setting of particleSettings)
228
- {
229
- const input = setting.input;
230
- const name = setting.name;
231
- const type = setting.type;
232
- const inputFloat = parseFloat(input.value) || 0;
233
- if (type == 'color')
234
- {
235
- const color = new LJS.Color().setHex(input.value);
236
- particleSystem[name].r = color.r;
237
- particleSystem[name].g = color.g;
238
- particleSystem[name].b = color.b;
239
- }
240
- else if (type == 'alpha')
241
- {
242
- if (name == 'colorStartA_alpha')
243
- particleSystem.colorStartA.a = LJS.clamp(inputFloat);
244
- else if (name == 'colorStartB_alpha')
245
- particleSystem.colorStartB.a = LJS.clamp(inputFloat);
246
- else if (name == 'colorEndA_alpha')
247
- particleSystem.colorEndA.a = LJS.clamp(inputFloat);
248
- else if (name == 'colorEndB_alpha')
249
- particleSystem.colorEndB.a = LJS.clamp(inputFloat);
250
- }
251
- else if (name == 'tileIndex')
252
- {
253
- const tileIndex = parseInt(input.value);
254
- particleSystem.tileIndex = tileIndex
255
- particleSystem.tileInfo = LJS.tile(tileIndex, particleSystem.tileInfo.size);
256
- }
257
- else if (name == 'tileSize')
258
- particleSystem.tileInfo.size = vec2(parseInt(input.value));
259
- else if (type == 'checkbox')
260
- particleSystem[name] = input.checked ? 1 : 0;
261
- else if (name == 'emitRate')
262
- particleSystem[name] = LJS.min(inputFloat,1e4);
263
- else
264
- particleSystem[name] = LJS.clamp(inputFloat, setting.min, setting.max);
265
- }
266
- shouldUpdateInput && updateInputs()
267
- }
268
-
269
- function updateInputs(save=1)
270
- {
271
- for (const setting of particleSettings)
272
- updateSetting(setting, save);
273
- particleSystemCode.value = getCode();
274
- }
275
-
276
- function updateSetting(setting, save=1)
277
- {
278
- const input = setting.input;
279
- const name = setting.name;
280
- const type = setting.type;
281
-
282
- if (type == 'color')
283
- {
284
- const color = particleSystem[name];
285
- input.value = color.toString(false);
286
- }
287
- else if (type == 'alpha')
288
- {
289
- if (name == 'colorStartA_alpha')
290
- input.value = particleSystem.colorStartA.a;
291
- else if (name == 'colorStartB_alpha')
292
- input.value = particleSystem.colorStartB.a;
293
- else if (name == 'colorEndA_alpha')
294
- input.value = particleSystem.colorEndA.a;
295
- else if (name == 'colorEndB_alpha')
296
- input.value = particleSystem.colorEndB.a;
297
- }
298
- else if (name == 'tileSize')
299
- input.value = particleSystem.tileInfo.size.x;
300
- else if (type == 'checkbox')
301
- input.checked = particleSystem[name];
302
- else
303
- input.value = particleSystem[name] || '0';
304
-
305
- if (save)
306
- {
307
- const storageName = storagePrefix + setting.name;
308
- localStorage[storageName] = type == 'checkbox' ?
309
- input.checked : input.value;
310
- }
311
- }
312
-
313
- function getCode()
314
- {
315
- const expand = inputExpand.checked;
316
- let code = '';
317
-
318
- // limit float precision to prevent long strings
319
- const trimFloat = (n, decimals=3)=>
320
- Number(Number(n).toFixed(decimals));
321
-
322
- code = 'new ParticleEmitter(';
323
- if (expand)
324
- code += '\n vec2(), 0,\t//position, angle\n';
325
- else
326
- code += 'vec2(), 0, ';
327
-
328
- let count = 0;
329
- for (const setting of particleSettings)
330
- {
331
- const name = setting.name;
332
- const type = setting.type;
333
- let value;
334
- if (name == 'tileSize' || type == 'alpha')
335
- continue;
336
-
337
- if (name == 'tileIndex')
338
- value = `tile(${particleSystem.tileIndex}, ${particleSystem.tileInfo.size.x})`;
339
- else if (type == 'color')
340
- {
341
- const c = particleSystem[name];
342
- value = `new Color(${trimFloat(c.r)}, ${trimFloat(c.g)}, ${trimFloat(c.b)}, ${trimFloat(c.a)})`;
343
- }
344
- else if (type == 'checkbox')
345
- value = particleSystem[name] ? 1 : 0;
346
- else
347
- value = trimFloat(particleSystem[name]);
348
- if (expand)
349
- code += ' ';
350
- code += value;
351
-
352
- const isEnd = name == 'randomColorLinear';
353
- if (expand)
354
- {
355
- code += ',\t// ' + name;
356
- if (!isEnd)
357
- code += '\n';
358
- }
359
- else if (!isEnd)
360
- code += ', ';
361
- }
362
-
363
- if (expand)
364
- code += '\n); // particle emitter';
365
- else
366
- code += ');';
367
-
368
- return code;
369
- }
370
-
371
- ///////////////////////////////////////////////////////////////////////////////
372
- function gameUpdate()
373
- {
374
- if (!restartTimer.isSet() && particleSystem.destroyed)
375
- restartTimer.set(1);
376
- else if (restartTimer.elapsed())
377
- {
378
- restartTimer.unset()
379
- makeEmitter();
380
- updateParticles();
381
- }
382
-
383
- if (document.activeElement == document.body)
384
- {
385
- if (LJS.mouseIsDown(0))
386
- {
387
- particleSystem.pos = LJS.mousePos;
388
- particleSystem.velocity = LJS.mouseDelta.scale(.3*LJS.timeDelta);
389
- }
390
- else
391
- {
392
- particleSystem.pos = vec2();
393
- particleSystem.velocity = vec2();
394
- }
395
- if (LJS.mouseWheel)
396
- {
397
- // zoom camera
398
- let cameraScale = LJS.cameraScale;
399
- cameraScale -= LJS.sign(LJS.mouseWheel)*cameraScale/5;
400
- cameraScale = LJS.clamp(cameraScale, 10, 300);
401
- LJS.setCameraScale(cameraScale);
402
- }
403
- }
404
- }
405
-
406
- ///////////////////////////////////////////////////////////////////////////////
407
- function gameUpdatePost()
408
- {
409
-
410
- }
411
-
412
- ///////////////////////////////////////////////////////////////////////////////
413
- function gameRender()
414
- {
415
- }
416
-
417
- ///////////////////////////////////////////////////////////////////////////////
418
- function gameRenderPost()
419
- {
420
- }
421
-
422
- ///////////////////////////////////////////////////////////////////////////////
423
- // Startup LittleJS Engine
424
- LJS.engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost, ['tiles.png']);
425
-
426
- </script>
Binary file