Changed the map
This commit is contained in:
parent
d1e7fa7956
commit
88e2522ab9
|
@ -1,7 +1,25 @@
|
|||
########################
|
||||
#......................#
|
||||
#......................#
|
||||
#......................#
|
||||
#......................#
|
||||
#......................#
|
||||
########################
|
||||
#########################
|
||||
####......#####....######
|
||||
###.........###.....#####
|
||||
##....#......###....#####
|
||||
##...###......##.....####
|
||||
##..######....##......###
|
||||
##..######....###.....###
|
||||
#...########..#####....##
|
||||
#....#######..######...##
|
||||
#....#####.......###....#
|
||||
##...####...#.....##....#
|
||||
###........######.###...#
|
||||
###.......##......###...#
|
||||
###...#..###.########...#
|
||||
##...#######.......###..#
|
||||
#....#############.#....#
|
||||
#.....####.###.....##..##
|
||||
#.........########.....##
|
||||
##...##############....##
|
||||
###...###..###.######..##
|
||||
###.......##....####...##
|
||||
####.#####......###...###
|
||||
#..###................###
|
||||
#..................######
|
||||
#########################
|
||||
|
|
|
@ -20,12 +20,12 @@ makeLenses ''Game
|
|||
newGame :: IO Game
|
||||
newGame = do
|
||||
dun <- makeDungeonFromFile "maps/test.map"
|
||||
return $ Game dun (Player $ V2 1 1)
|
||||
return $ Game dun (Player $ V2 1 24)
|
||||
|
||||
runAction :: Action -> Game -> Maybe Game
|
||||
runAction (Move vec) game =
|
||||
if ableToMove then Just $ game & player . pos .~ newPos
|
||||
else Just game
|
||||
runAction (Move vec) game = Just $ if ableToMove
|
||||
then game & player . pos .~ newPos
|
||||
else game
|
||||
where ableToMove = getCell newPos (game ^. dungeon) == Empty
|
||||
newPos = (game ^. player . pos) + vec
|
||||
runAction None g = Just g
|
||||
|
|
Loading…
Reference in New Issue