@@ -343,9 +343,6 @@ <h2><a id="settings">Game Configuration</a></h2>
343
343
// scale to fill the canvas
344
344
settings.autoscale = true
345
345
346
- // target FPS
347
- settings.fps = 60
348
-
349
346
// enable smooth drawing
350
347
settings.antialias = false
351
348
@@ -541,19 +538,7 @@ <h2><a id="keyboard">Functions for Keyboard</a></h2>
541
538
542
539
< h2 > < a id ="math "> Math</ a > </ h2 >
543
540
544
- < pre > < code class ="language-typescript ">
545
- // Generates a pseudo-random float between min (inclusive)
546
- // and max (exclusive)
547
- rand(min = 0, max = 1.0): number;
548
-
549
- // Generates a pseudo-random integer between min (inclusive)
550
- // and max (inclusive)
551
- randi(min = 0, max = 1): number;
552
-
553
- // If a value is passed, initializes the random number generator (RNG)
554
- // with an explicit seed value (a number > = 0). Otherwise, returns the current seed state.
555
- // By default, the initial seed is the current timestamp (from `Date.now()`).
556
- seed(value: number | null): number;
541
+ < pre > < code class ="language-typescript "> /** General Math */
557
542
558
543
// Calculates a linear (interpolation) value over `t`.
559
544
// example: lerp(0, 50, 0.5) returns 25
@@ -644,7 +629,22 @@ <h2><a id="math">Math</a></h2>
644
629
// If the number is 0, it will returns 0.
645
630
sign(n: number): number
646
631
647
- /** UTILS */
632
+ /** Random Number Generator (RNG) */
633
+
634
+ // Generates a pseudo-random float between min (inclusive)
635
+ // and max (exclusive)
636
+ rand(min = 0, max = 1.0): number;
637
+
638
+ // Generates a pseudo-random integer between min (inclusive)
639
+ // and max (inclusive)
640
+ randi(min = 0, max = 1): number;
641
+
642
+ // If a value is passed, initializes the random number generator (RNG)
643
+ // with an explicit seed value (a number > = 0). Otherwise, returns the current seed state.
644
+ // By default, the initial seed is the current timestamp (from `Date.now()`).
645
+ seed(value: number | null): number;
646
+
647
+ /** Collision Check (AABB) */
648
648
649
649
// Check a collision between two rectangles.
650
650
// All arguments are required and must be numbers.
@@ -671,18 +671,14 @@ <h2><a id="engine-api">Engine API</a></h2>
671
671
// Also, emits the "resized" (use `listen` to observe this event).
672
672
resize(width: number, height: number): void
673
673
674
- // shutdown the engine
675
- // also emits the "quit" event
676
- quit(): void
677
-
678
674
// Sets the scale of the game's delta time (dt).
679
675
// By default is equal to 1.
680
676
// Values higher than 1 increase the speed of time,
681
677
// while values smaller than 1 decrease it.
682
678
// A value of 0 freezes time (equivalent to pausing).
683
679
timescale(value: number): void
684
680
685
- // Sets the target FPS at runtime
681
+ // Sets the target FPS (frames per second or frame rate)
686
682
setfps(value: number): void
687
683
688
684
// the following functions are most used by plugins...
@@ -694,7 +690,9 @@ <h2><a id="engine-api">Engine API</a></h2>
694
690
// example: getcolor(0) returns "#111"
695
691
getcolor(index: number): string
696
692
697
- </ code > </ pre >
693
+ // shutdown the engine
694
+ // also emits the "quit" event
695
+ quit(): void</ code > </ pre >
698
696
699
697
< h2 > < a id ="advanced "> Playground Features</ a > </ h2 >
700
698
0 commit comments