mirror of
https://github.com/jtdaugherty/brick.git
synced 2025-01-05 21:03:07 +03:00
Rogue: updates
This commit is contained in:
parent
2b76a75d16
commit
86332b6c6b
@ -114,23 +114,16 @@ movePlayer world dx dy = do
|
||||
_ -> world
|
||||
|
||||
updateDisplay :: World -> [Widget]
|
||||
updateDisplay world = info : translatedWorldLayers
|
||||
updateDisplay world = [ info, playerLayer, geoLayer ]
|
||||
where
|
||||
info = vBox [ hCentered $ txt "Move with the arrows keys. Press ESC to exit."
|
||||
, hBorder '-'
|
||||
]
|
||||
playerLoc = Location $ playerCoord $ player world
|
||||
translatedWorldLayers = centeredAbout playerLoc <$> worldLayers world
|
||||
|
||||
worldLayers :: World -> [Widget]
|
||||
worldLayers world = [ playerWidget
|
||||
, liftVty $ levelGeoImage theLevel
|
||||
]
|
||||
where
|
||||
(px, py) = playerCoord $ player world
|
||||
playerLoc = Location (px, py)
|
||||
theLevel = level world
|
||||
thePlayer = player world
|
||||
(px, py) = (playerX thePlayer, playerY thePlayer)
|
||||
playerWidget = translated (Location (px, py)) $ liftVty (char pieceA '@')
|
||||
playerLayer = centeredAbout playerLoc $ translated playerLoc $ liftVty (char pieceA '@')
|
||||
geoLayer = centeredAbout playerLoc $ liftVty $ levelGeoImage theLevel
|
||||
|
||||
imageForGeo :: LevelPiece -> Image
|
||||
imageForGeo EmptySpace = char (defAttr `withBackColor` green) ' '
|
||||
|
Loading…
Reference in New Issue
Block a user