aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Point.elm
blob: c0daeaff0e0bed305ea0fa4976c5701d62a9e2d2 (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
25
26
27
28
29
30
31
32
33
34
module Model.Point
  ( Point
  , pointMove
  , pointSize
  , pointSpeed
  , pointSpawnDist
  , pointAwayDist
  ) where

import Model.Vec2 exposing (..)
import Model.Board exposing (boardDiagonal)

type alias Point =
  { initTime : Float
  , initPos : Vec2
  , initDest : Vec2
  , move : Float -> Vec2 -> Vec2 -> Float -> Vec2
  }

pointMove : Point -> Float -> Vec2
pointMove {initTime, initPos, initDest, move} time =
  move initTime initPos initDest time

pointSize : Float
pointSize = 10

pointSpeed : Float -> Float
pointSpeed dt = dt / 20

pointSpawnDist : Vec2 -> Float
pointSpawnDist boardSize = (boardDiagonal boardSize) * 2.5 / 5 + pointSize

pointAwayDist : Vec2 -> Float
pointAwayDist boardSize = (boardDiagonal boardSize) * 3 / 5 + pointSize