summaryrefslogtreecommitdiff
blob: ffe3f0d61458609b9dae99dffff7a961ff5248bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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