| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-15 09:52:54 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-15 09:52:54 +0200 | 
| commit | 9a2d8f37dea8e14afa57affb135def13954df547 (patch) | |
| tree | ee7daa101ffdb76bc4a5932c3698b6a89613df78 /client/elm/battlemap/src/Battlemap/Tile.elm | |
Satisfied with Elm so far, let's go with it.
Diffstat (limited to 'client/elm/battlemap/src/Battlemap/Tile.elm')
| -rw-r--r-- | client/elm/battlemap/src/Battlemap/Tile.elm | 41 | 
1 files changed, 41 insertions, 0 deletions
| diff --git a/client/elm/battlemap/src/Battlemap/Tile.elm b/client/elm/battlemap/src/Battlemap/Tile.elm new file mode 100644 index 0000000..e8f2493 --- /dev/null +++ b/client/elm/battlemap/src/Battlemap/Tile.elm @@ -0,0 +1,41 @@ +module Battlemap.Tile exposing (Tile, generate, set_direction) + +import Battlemap.Direction exposing (..) + +import List exposing (map) +import Array exposing (Array, fromList) + +type alias Tile = +   { +      floor_level : Int, +      nav_level : Direction +--      char_level : Int, +--      mod_level : Int +   } + +set_direction : Tile -> Direction -> Tile +set_direction t d = +   {t | nav_level = d} + +from_int : Int -> Tile +from_int i = +   { +      floor_level = i, +      nav_level = None +   } + +generate : Int -> Int -> (Array Tile) +generate width height = +   (fromList +      (map +         (from_int) +         [ +            1, 1, 1, 2, 2, 2, +            1, 0, 0, 0, 0, 2, +            1, 0, 1, 2, 0, 2, +            3, 0, 3, 4, 0, 4, +            3, 0, 0, 0, 0, 4, +            3, 3, 3, 4, 4, 4 +         ] +      ) +   ) | 


