From f47b2e3f68e69238b731d6183e739805db20ae5b Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 14 Feb 2021 20:25:55 +0100 Subject: Control a ship that can fire missiles --- src/util/number.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/util/number.ts (limited to 'src/util/number.ts') 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)) +} -- cgit v1.2.3