aboutsummaryrefslogtreecommitdiff
path: root/static/src/vector.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-08-24 19:11:26 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-08-24 19:16:22 -0700
commita0a2068b66204d7d06eb3c3b4aa61b28469121f6 (patch)
treee9706970af1ce8b4d12df9c0a3f64fa17ca74b97 /static/src/vector.ts
parentb144ad5df76e458297bd6dc030cad4af0f344901 (diff)
downloadkennel.hatecomputers.club-a0a2068b66204d7d06eb3c3b4aa61b28469121f6.tar.gz
kennel.hatecomputers.club-a0a2068b66204d7d06eb3c3b4aa61b28469121f6.zip
improve event parsing and begin sending events from the client
Diffstat (limited to 'static/src/vector.ts')
-rw-r--r--static/src/vector.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/static/src/vector.ts b/static/src/vector.ts
new file mode 100644
index 0000000..e7be9fa
--- /dev/null
+++ b/static/src/vector.ts
@@ -0,0 +1,10 @@
+export class Vec2 {
+ constructor(
+ private readonly x: number,
+ private readonly y: number,
+ ) {}
+
+ public distance_to(that: Vec2): number {
+ return Math.sqrt((this.x - that.x) ** 2 + (this.y - that.y) ** 2);
+ }
+}