aboutsummaryrefslogtreecommitdiff
path: root/src/Target.elm
blob: 92ab4c21cbe0b906f262c95b1e7b82a176f5cfdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 }
  }