Fix rendering issue

This commit is contained in:
Tibo De Peuter 2022-12-22 23:06:59 +01:00
parent f3bce99120
commit ef784c2dbc
9 changed files with 28 additions and 25 deletions

View file

@ -94,5 +94,5 @@ toggleInventoryShown shown g@Game{ state = s@Playing{ player = p }}= newGame
-- Map all Physicals onto coordinates
putCoords :: Level -> [(X, Y, Physical)]
putCoords l@Level{ layout = lay } = concatMap (\(a, bs) -> map (\(b, c) -> (b, a, c)) bs) numberedList
where numberedStrips = zip [0::Int .. ] lay
where numberedStrips = reverse $ zip [0::Int .. ] $ reverse lay
numberedList = map (\(x, strip) -> (x, zip [0::Int ..] strip)) numberedStrips

View file

@ -23,7 +23,8 @@ unknownImage = "unknown.png"
allEntities :: [(String, FilePath)]
allEntities = [
("player", "player.png"),
("door", "door.png")
("devil", "devil.png" ),
("door", "door.png")
]
allEnvironment :: [(String, FilePath)]
@ -39,7 +40,9 @@ allEnvironment = [
allItems :: [(String, FilePath)]
allItems = [
("dagger", "dagger.png"),
("key", "key.png" )
("key", "key.png" ),
("potion", "potion.png"),
("sword", "sword.png" )
]
allGui :: [(String, FilePath)]

View file

@ -48,7 +48,7 @@ renderLevel Level{ layout = l, items = i, entities = e } = level
entities = renderEntities e
renderLayout :: Layout -> Picture
renderLayout strips = pictures [setRenderPos 0 y (renderStrip (strips !! y)) | y <- [0 .. count]]
renderLayout strips = pictures [setRenderPos 0 (count - y) (renderStrip (strips !! y)) | y <- [0 .. count]]
where count = length strips - 1
renderStrip :: [Physical] -> Picture