aboutsummaryrefslogtreecommitdiff
path: root/src/Target.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Target.elm')
-rw-r--r--src/Target.elm24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Target.elm b/src/Target.elm
new file mode 100644
index 0000000..92ab4c2
--- /dev/null
+++ b/src/Target.elm
@@ -0,0 +1,24 @@
+module Target where
+
+import Board (boardSize)
+import Geometry (distance)
+import Vec2 (Vec2)
+import Player (..)
+
+type Target =
+ { score : Int
+ , pos : Vec2
+ }
+
+targetSize : Float
+targetSize = 20
+
+targetCollision : Player -> Target -> Bool
+targetCollision player target =
+ (distance player.pos target.pos) < playerSize + targetSize
+
+initTarget : Target
+initTarget =
+ { score = 0
+ , pos = { x = 50, y = 0 }
+ }