aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-15 09:40:58 +0100
committerJoris Guyonvarch2015-03-15 09:40:58 +0100
commitce6775641639943a2aee00fa9c2d684aa434bc21 (patch)
treee5c1b37525cf83f588d82fbf8977ae2839b6e41f /src/Model
parent87386e8b148c2536214fdaf6c3140853c751d7b4 (diff)
Moving boardSize to Game model
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/Board.elm10
-rw-r--r--src/Model/Game.elm3
-rw-r--r--src/Model/Point.elm8
3 files changed, 12 insertions, 9 deletions
diff --git a/src/Model/Board.elm b/src/Model/Board.elm
index 1361cfb..05fd036 100644
--- a/src/Model/Board.elm
+++ b/src/Model/Board.elm
@@ -1,17 +1,17 @@
module Model.Board
- ( boardSize
+ ( initBoardSize
, boardDiagonal
) where
import Model.Vec2 (Vec2)
-boardSize : Vec2
-boardSize =
+initBoardSize : Vec2
+initBoardSize =
{ x = 500
, y = 500
}
-boardDiagonal : Float
-boardDiagonal =
+boardDiagonal : Vec2 -> Float
+boardDiagonal boardSize =
boardSize.x ^ 2 + boardSize.y ^ 2
|> sqrt
diff --git a/src/Model/Game.elm b/src/Model/Game.elm
index 6a9020f..9133ba0 100644
--- a/src/Model/Game.elm
+++ b/src/Model/Game.elm
@@ -11,9 +11,11 @@ import Model.Cloud (..)
import Model.Vec2 (Vec2)
import Model.Config (..)
import Model.Round (Round)
+import Model.Board (initBoardSize)
type alias Game =
{ time : Float
+ , boardSize : Vec2
, keysDown : List KeyCode
, currentScore : Int
, player : Player
@@ -25,6 +27,7 @@ type alias Game =
initialGame : Seed -> Game
initialGame seed =
{ time = 0
+ , boardSize = initBoardSize
, keysDown = []
, currentScore = 0
, player = initPlayer
diff --git a/src/Model/Point.elm b/src/Model/Point.elm
index 41967b6..40043a5 100644
--- a/src/Model/Point.elm
+++ b/src/Model/Point.elm
@@ -27,8 +27,8 @@ pointSize = 10
pointSpeed : Float -> Float
pointSpeed dt = dt / 20
-pointSpawnDist : Float
-pointSpawnDist = boardDiagonal * 3 / 5
+pointSpawnDist : Vec2 -> Float
+pointSpawnDist boardSize = (boardDiagonal boardSize) * 3 / 5
-pointAwayDist : Float
-pointAwayDist = boardDiagonal * 3 / 4
+pointAwayDist : Vec2 -> Float
+pointAwayDist boardSize = (boardDiagonal boardSize) * 3 / 4