aboutsummaryrefslogtreecommitdiff
path: root/src/macroknight/utils.hy
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2025-05-18 09:18:07 +0100
committerGene Pasquet <dev@etenil.net>2025-05-18 09:18:07 +0100
commite30b2a81b48f5e86474aa2c38d7034d63c0b7c4e (patch)
tree585e05b0238b36761a6616fa2c6c8627e96876fc /src/macroknight/utils.hy
parent1cf28e193729ee64a17e6464ce7310c67f5eae34 (diff)
Enemies sort of working
Diffstat (limited to 'src/macroknight/utils.hy')
-rw-r--r--src/macroknight/utils.hy7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/macroknight/utils.hy b/src/macroknight/utils.hy
index dde8d2e..5de8887 100644
--- a/src/macroknight/utils.hy
+++ b/src/macroknight/utils.hy
@@ -1,4 +1,5 @@
-(import enum [Enum])
+(import enum [Enum]
+ math [sqrt])
(defclass Direction [Enum]
(setv UP "UP")
@@ -44,3 +45,7 @@
(defn sub-points [point1 point2]
#((- (get point2 0) (get point1 0))
(- (get point2 1) (get point2 1))))
+
+(defn distance [point1 point2]
+ (sqrt (+ (** (- (get point1 0) (get point2 0)) 2)
+ (** (- (get point1 1) (get point2 1)) 2))))