diff options
author | Joris | 2021-02-14 20:25:55 +0100 |
---|---|---|
committer | Joris | 2021-02-14 20:25:55 +0100 |
commit | f47b2e3f68e69238b731d6183e739805db20ae5b (patch) | |
tree | 2eaa3937cdec3dccf4e751f9b519833740e69aca /src/util | |
parent | 0b60fd8c2cf5746a45cea137d2eac918ca7a8307 (diff) |
Control a ship that can fire missiles
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/number.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/util/number.ts b/src/util/number.ts new file mode 100644 index 0000000..87f1e2e --- /dev/null +++ b/src/util/number.ts @@ -0,0 +1,3 @@ +export function clamp(x: number, min: number, max: number): number { + return Math.max(min, Math.min(max, x)) +} |