littlejsengine 1.18.2 → 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 (172) hide show
  1. package/COPYRIGHT.txt +38 -0
  2. package/FAQ.md +633 -0
  3. package/LICENSE +5 -27
  4. package/README.md +19 -1
  5. package/dist/littlejs.d.ts +550 -57
  6. package/dist/littlejs.esm.js +2208 -492
  7. package/dist/littlejs.esm.min.js +1 -1
  8. package/dist/littlejs.js +2165 -480
  9. package/dist/littlejs.min.js +1 -1
  10. package/dist/littlejs.release.js +2166 -481
  11. package/package.json +8 -1
  12. package/plugins/box2d.js +36 -9
  13. package/{src/engineMedals.js → plugins/medalSystem.js} +248 -196
  14. package/plugins/pathFinder.js +758 -0
  15. package/plugins/pluginExport.js +26 -0
  16. package/plugins/tween.js +509 -0
  17. package/plugins/tweenSystem.js +509 -0
  18. package/plugins/uiSystem.js +151 -12
  19. package/src/engine.js +9 -145
  20. package/src/engineAudio.js +8 -5
  21. package/src/engineBuild.mjs +4 -1
  22. package/src/engineDebug.js +1 -1
  23. package/src/engineDraw.js +154 -5
  24. package/src/engineExport.js +17 -12
  25. package/src/engineInput.js +27 -1
  26. package/src/engineLogo.js +146 -0
  27. package/src/engineMath.js +10 -3
  28. package/src/engineObject.js +11 -5
  29. package/src/engineParticles.js +6 -3
  30. package/src/engineRelease.js +1 -1
  31. package/src/engineSettings.js +17 -47
  32. package/src/engineUtilities.js +7 -2
  33. package/src/engineWebGL.js +31 -8
  34. package/src/jsconfig.json +3 -1
  35. package/.claude/settings.local.json +0 -7
  36. package/.github/workflows/test.yml +0 -17
  37. package/AI.md +0 -172
  38. package/CLAUDE.md +0 -1
  39. package/examples/box2d/game.js +0 -192
  40. package/examples/box2d/gameObjects.js +0 -564
  41. package/examples/box2d/index.html +0 -9
  42. package/examples/box2d/scenes.js +0 -194
  43. package/examples/box2d/tiles.png +0 -0
  44. package/examples/breakout/game.js +0 -175
  45. package/examples/breakout/gameObjects.js +0 -147
  46. package/examples/breakout/index.html +0 -8
  47. package/examples/breakout/tiles.png +0 -0
  48. package/examples/breakoutTutorial/README.md +0 -521
  49. package/examples/breakoutTutorial/game.js +0 -191
  50. package/examples/breakoutTutorial/images/1.png +0 -0
  51. package/examples/breakoutTutorial/images/10.png +0 -0
  52. package/examples/breakoutTutorial/images/11.png +0 -0
  53. package/examples/breakoutTutorial/images/2.png +0 -0
  54. package/examples/breakoutTutorial/images/3.png +0 -0
  55. package/examples/breakoutTutorial/images/4.png +0 -0
  56. package/examples/breakoutTutorial/images/5.png +0 -0
  57. package/examples/breakoutTutorial/images/6.png +0 -0
  58. package/examples/breakoutTutorial/images/7.png +0 -0
  59. package/examples/breakoutTutorial/images/8.png +0 -0
  60. package/examples/breakoutTutorial/images/9.png +0 -0
  61. package/examples/breakoutTutorial/index.html +0 -8
  62. package/examples/electron/build.mjs +0 -127
  63. package/examples/electron/electron.js +0 -35
  64. package/examples/electron/game.js +0 -54
  65. package/examples/electron/index.html +0 -13
  66. package/examples/electron/package.json +0 -5
  67. package/examples/electron/tiles.png +0 -0
  68. package/examples/empty/game.js +0 -51
  69. package/examples/empty/index.html +0 -5
  70. package/examples/empty/tiles.png +0 -0
  71. package/examples/favicon.png +0 -0
  72. package/examples/games.jpg +0 -0
  73. package/examples/htmlMenu/game.js +0 -82
  74. package/examples/htmlMenu/index.html +0 -45
  75. package/examples/htmlMenu/tiles.png +0 -0
  76. package/examples/index.html +0 -800
  77. package/examples/logo.png +0 -0
  78. package/examples/logo2.png +0 -0
  79. package/examples/module/build.mjs +0 -124
  80. package/examples/module/game.js +0 -132
  81. package/examples/module/index.html +0 -10
  82. package/examples/module/tiles.png +0 -0
  83. package/examples/particles/index.html +0 -426
  84. package/examples/particles/tiles.png +0 -0
  85. package/examples/platformer/data/gameLevelData.tmx +0 -143
  86. package/examples/platformer/data/gameLevelData.tsx +0 -4
  87. package/examples/platformer/game.js +0 -147
  88. package/examples/platformer/gameCharacter.js +0 -309
  89. package/examples/platformer/gameEffects.js +0 -278
  90. package/examples/platformer/gameLevel.js +0 -205
  91. package/examples/platformer/gameLevelData.json +0 -171
  92. package/examples/platformer/gameObjects.js +0 -378
  93. package/examples/platformer/gamePlayer.js +0 -35
  94. package/examples/platformer/index.html +0 -9
  95. package/examples/platformer/tiles.png +0 -0
  96. package/examples/platformer/tilesLevel.png +0 -0
  97. package/examples/puzzle/game.js +0 -331
  98. package/examples/puzzle/index.html +0 -8
  99. package/examples/puzzle/tiles.png +0 -0
  100. package/examples/screenshot.jpg +0 -0
  101. package/examples/shorts/animation.js +0 -18
  102. package/examples/shorts/base.html +0 -54
  103. package/examples/shorts/blending.js +0 -14
  104. package/examples/shorts/box2d.js +0 -51
  105. package/examples/shorts/box2dCar.js +0 -59
  106. package/examples/shorts/box2dPool.js +0 -107
  107. package/examples/shorts/box2dTileLayer.js +0 -48
  108. package/examples/shorts/cameraDrag.js +0 -22
  109. package/examples/shorts/clock.js +0 -21
  110. package/examples/shorts/colors.js +0 -25
  111. package/examples/shorts/debugDraw.js +0 -37
  112. package/examples/shorts/empty.js +0 -30
  113. package/examples/shorts/flappyGame.js +0 -55
  114. package/examples/shorts/fontImage.js +0 -17
  115. package/examples/shorts/fps.js +0 -90
  116. package/examples/shorts/helloWorld.js +0 -11
  117. package/examples/shorts/hillGlideGame.js +0 -63
  118. package/examples/shorts/input.js +0 -64
  119. package/examples/shorts/landerGame.js +0 -57
  120. package/examples/shorts/maze.js +0 -48
  121. package/examples/shorts/medals.js +0 -51
  122. package/examples/shorts/music.js +0 -78
  123. package/examples/shorts/musicPlayer.js +0 -137
  124. package/examples/shorts/nineSlice.js +0 -40
  125. package/examples/shorts/parallax.js +0 -72
  126. package/examples/shorts/particles.js +0 -28
  127. package/examples/shorts/piano.js +0 -44
  128. package/examples/shorts/platformer.js +0 -45
  129. package/examples/shorts/pongGame.js +0 -41
  130. package/examples/shorts/postProcess.js +0 -62
  131. package/examples/shorts/sequencer.js +0 -124
  132. package/examples/shorts/shader.js +0 -29
  133. package/examples/shorts/shapes.js +0 -21
  134. package/examples/shorts/slidingPuzzle.js +0 -52
  135. package/examples/shorts/song.mp3 +0 -0
  136. package/examples/shorts/sound.js +0 -36
  137. package/examples/shorts/spaceGame.js +0 -58
  138. package/examples/shorts/spriteAtlas.js +0 -31
  139. package/examples/shorts/starfield.js +0 -15
  140. package/examples/shorts/texture.js +0 -16
  141. package/examples/shorts/tileLayer.js +0 -48
  142. package/examples/shorts/tileRaycast.js +0 -39
  143. package/examples/shorts/tiles.png +0 -0
  144. package/examples/shorts/tiltedView.js +0 -63
  145. package/examples/shorts/timers.js +0 -53
  146. package/examples/shorts/topDown.js +0 -38
  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/starter/build.bat +0 -7
  151. package/examples/starter/build.mjs +0 -126
  152. package/examples/starter/game.js +0 -137
  153. package/examples/starter/index.html +0 -35
  154. package/examples/starter/tiles.png +0 -0
  155. package/examples/stress/index.html +0 -173
  156. package/examples/style.css +0 -150
  157. package/examples/typescript/build.mjs +0 -60
  158. package/examples/typescript/game.js +0 -100
  159. package/examples/typescript/game.ts +0 -132
  160. package/examples/typescript/index.html +0 -10
  161. package/examples/typescript/tiles.png +0 -0
  162. package/examples/typescript/tsconfig.json +0 -17
  163. package/examples/uiSystem/game.js +0 -139
  164. package/examples/uiSystem/index.html +0 -10
  165. package/examples/uiSystem/tiles.png +0 -0
  166. package/jsconfig.json +0 -12
  167. package/plugins/desktop.ini +0 -2
  168. package/reference.md +0 -447
  169. package/test/math.test.mjs +0 -774
  170. package/test/setup.mjs +0 -22
  171. package/test/smoke.test.mjs +0 -258
  172. 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