Skip to content

Commit 203a590

Browse files
committed
update engine
1 parent e97d7e0 commit 203a590

File tree

6 files changed

+60
-25
lines changed

6 files changed

+60
-25
lines changed

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/about.html

+29-12
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,9 @@ <h2><a id="sound">Functions for Sound</a></h2>
313313
// example: sfx([2,.05,598,.07,0,.19,0,1.32,9.9,-70,0,0,0,0,0,0,.3,.02,0,.04])
314314
sfx(ZzFXparams: Array, volume = 1, pitch = 0, randomness = 0): AudioBufferSourceNode</code></pre>
315315

316-
<h2><a id="math">Functions for Math</a></h2>
317-
318-
<pre><code class="language-typescript">// check a collision between two rectangles
319-
// all arguments are required and must be numbers
320-
colrect(x1, y1, w1, h1, x2, y2, w2, h2): boolean
321-
322-
// check a collision between two circles
323-
// all arguments are required and must be numbers
324-
colcirc(x1, y1, r1, x2, y2, r2): boolean
316+
<h2><a id="math">Math</a></h2>
325317

318+
<pre><code class="language-typescript">
326319
// Generates a pseudo-random float between min (inclusive) and max (exclusive)
327320
rand(min = 0, max = 1.0): number;
328321

@@ -353,6 +346,19 @@ <h2><a id="math">Functions for Math</a></h2>
353346
// example: clamp(-10, 0, 100) return 0
354347
clamp(value: number, min: number, max: number): number
355348

349+
// Re-maps a number from one range to another.
350+
// example: map(2, 0, 10, 0, 100) returns 20
351+
map(val, l1, h1, l2, h2, withinBounds = false ): number
352+
353+
// Maps a number from one range to a value between 0 and 1.
354+
// example: norm(50, 0, 100) returns 0.5
355+
norm(val, start, stop): number
356+
357+
// Calculates the positive difference of two given numbers.
358+
// example: diff(20, 30) return 10
359+
// example: diff(-3, 3) return 6
360+
diff(a, b): number
361+
356362
// Returns the sine of a number in radians.
357363
sin(angle: number): number
358364

@@ -411,6 +417,14 @@ <h2><a id="math">Functions for Math</a></h2>
411417
// Returns 1 or -1, indicating the sign of a number.
412418
// If the number is 0, it will returns 0.
413419
sign(n: number): number
420+
421+
// check a collision between two rectangles
422+
// all arguments are required and must be numbers
423+
colrect(x1, y1, w1, h1, x2, y2, w2, h2): boolean
424+
425+
// check a collision between two circles
426+
// all arguments are required and must be numbers
427+
colcirc(x1, y1, r1, x2, y2, r2): boolean
414428
</code></pre>
415429

416430
<h2><a id="globals">Globals Variables</a></h2>
@@ -448,9 +462,12 @@ <h2><a id="globals">Globals Variables</a></h2>
448462
// the tap/click Y position
449463
TAPY: number
450464

451-
// The ratio of the circumference of a circle to its diameter,
452-
// approximately 3.14159
453-
PI: number
465+
// Math constants
466+
PI: number // approximately 3.14159 radians (180º)
467+
468+
TWO_PI: number // approximately 6.28318 radians (360º)
469+
470+
HALF_PI: number // approximately 1.57079 radians (90º)
454471
</code></pre>
455472

456473
<h2><a id="advanced">Advanced Features</a></h2>

public/app.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/litecanvas.js

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)