| 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/Location.elm | |
Satisfied with Elm so far, let's go with it.
Diffstat (limited to 'client/elm/battlemap/src/Battlemap/Location.elm')
| -rw-r--r-- | client/elm/battlemap/src/Battlemap/Location.elm | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/client/elm/battlemap/src/Battlemap/Location.elm b/client/elm/battlemap/src/Battlemap/Location.elm new file mode 100644 index 0000000..ffe3f0d --- /dev/null +++ b/client/elm/battlemap/src/Battlemap/Location.elm @@ -0,0 +1,18 @@ +module Battlemap.Location exposing (..) + +import Battlemap.Direction exposing (..) + +type alias Location = +   { +      x : Int, +      y : Int +   } + +neighbor : Location -> Direction -> Location +neighbor loc dir = +   case dir of +      Right -> {loc | x = (loc.x + 1)} +      Left -> {loc | x = (loc.x - 1)} +      Up -> {loc | y = (loc.y - 1)} +      Down -> {loc | y = (loc.y + 1)} +      None -> loc | 


