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 :: IO Game
|
||||||
newGame = do
|
newGame = do
|
||||||
dun <- makeDungeonFromFile "maps/test.map"
|
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 :: Action -> Game -> Maybe Game
|
||||||
runAction (Move vec) game =
|
runAction (Move vec) game = Just $ if ableToMove
|
||||||
if ableToMove then Just $ game & player . pos .~ newPos
|
then game & player . pos .~ newPos
|
||||||
else Just game
|
else game
|
||||||
where ableToMove = getCell newPos (game ^. dungeon) == Empty
|
where ableToMove = getCell newPos (game ^. dungeon) == Empty
|
||||||
newPos = (game ^. player . pos) + vec
|
newPos = (game ^. player . pos) + vec
|
||||||
runAction None g = Just g
|
runAction None g = Just g
|
||||||
|
|
Loading…
Reference in New Issue