diff options
author | Joris Guyonvarch | 2014-10-03 16:18:24 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2014-10-03 16:18:24 +0200 |
commit | a1a3dbadffaaab290a6b6bb4b61df787d3b8ffdd (patch) | |
tree | 039b6b171d9dbdc2c10101a3a5664125a4eddcbf /src/Target.elm | |
parent | b3975b15a16fb22739f2d633caaeed0cb1c39ab7 (diff) |
Adding a target to catch
Diffstat (limited to 'src/Target.elm')
-rw-r--r-- | src/Target.elm | 24 |
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 } + } |