diff --git a/assets/entities/devil.png b/assets/entities/devil.png new file mode 100644 index 0000000..1ab3ef5 Binary files /dev/null and b/assets/entities/devil.png differ diff --git a/assets/items/potion.png b/assets/items/potion.png new file mode 100644 index 0000000..f2bf7bb Binary files /dev/null and b/assets/items/potion.png differ diff --git a/assets/items/sword.png b/assets/items/sword.png new file mode 100644 index 0000000..ba64389 Binary files /dev/null and b/assets/items/sword.png differ diff --git a/levels/level3.txt b/levels/level3.txt index 349c63c..7a48a9c 100644 --- a/levels/level3.txt +++ b/levels/level3.txt @@ -29,8 +29,8 @@ levels: [ items: [ { id: "sword", - x: 2, - y: 3, + x: 3, + y: 4, name: "Zwaard", description: "Meer schade tegen monsters", useTimes: infinite, @@ -43,8 +43,8 @@ levels: [ }, { id: "potion", - x: 3, - y: 1, + x: 4, + y: 2, name: "Levensbrouwsel", description: "Geeft een aantal levenspunten terug", useTimes: 1, @@ -60,8 +60,8 @@ levels: [ entities: [ { id: "devil", - x: 4, - y: 3, + x: 5, + y: 4, name: "Duivel", description: "Een monster uit de hel", hp: 50, diff --git a/levels/level4.txt b/levels/level4.txt index ba5b8e5..1417276 100644 --- a/levels/level4.txt +++ b/levels/level4.txt @@ -42,8 +42,8 @@ levels: [ items: [ { id: "key", - x: 0, - y: 1, + x: 1, + y: 2, name: "Sleutel", description: "Deze sleutel kan een deur openen", useTimes: 1, @@ -58,8 +58,8 @@ levels: [ entities: [ { id: "door", - x: 0, - y: 3, + x: 1, + y: 4, name: "Deur", description: "Deze deur kan geopend worden met een sleutel", direction: up, @@ -84,8 +84,8 @@ levels: [ items: [ { id: "sword", - x: 2, - y: 3, + x: 3, + y: 4, name: "Zwaard", description: "Meer schade tegen monsters", useTimes: infinite, @@ -98,8 +98,8 @@ levels: [ }, { id: "potion", - x: 3, - y: 1, + x: 4, + y: 2, name: "Levensbrouwsel", description: "Geeft een aantal levenspunten terug", useTimes: 1, @@ -115,8 +115,8 @@ levels: [ entities: [ { id: "devil", - x: 4, - y: 3, + x: 5, + y: 4, name: "Duivel", description: "Een monster uit de hel", hp: 50, diff --git a/lib/RPGEngine/Input/Playing.hs b/lib/RPGEngine/Input/Playing.hs index 9703560..cff2b86 100644 --- a/lib/RPGEngine/Input/Playing.hs +++ b/lib/RPGEngine/Input/Playing.hs @@ -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 \ No newline at end of file diff --git a/lib/RPGEngine/Render/Core.hs b/lib/RPGEngine/Render/Core.hs index 0c6754c..b04c9fe 100644 --- a/lib/RPGEngine/Render/Core.hs +++ b/lib/RPGEngine/Render/Core.hs @@ -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)] diff --git a/lib/RPGEngine/Render/Playing.hs b/lib/RPGEngine/Render/Playing.hs index 6a2f589..f902178 100644 --- a/lib/RPGEngine/Render/Playing.hs +++ b/lib/RPGEngine/Render/Playing.hs @@ -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 diff --git a/test/Parser/GameSpec.hs b/test/Parser/GameSpec.hs index b2b7371..c441a22 100644 --- a/test/Parser/GameSpec.hs +++ b/test/Parser/GameSpec.hs @@ -11,8 +11,8 @@ import RPGEngine.Parse.TextToStructure (gameFile) spec :: Spec spec = do describe "Game" $ do - -- TODO There is a weird bug that caused this to go in an infinite loop. Fix later. - xit "Simple game" $ do + it "Simple game" $ do + pendingWith "There is a weird bug that caused this to go in an infinite loop. Fix later." let input = "player: {\n hp: 50,\n inventory: []\n}\n\nlevels: [\n {\n layout: {\n | * * * * * *\n | * s . . e *\n | * * * * * *\n },\n \n items: [],\n\n entities: []\n\n\n }\n]" correct = Game { state = Playing { @@ -37,9 +37,9 @@ spec = do (Right struct) = parseWith gameFile input structureToGame struct `shouldBe` correct it "More complex game" $ do - pendingWith "fix parsing first" + pendingWith "Still need to write this" it "Game with multiple levels" $ do - pendingWith "fix parsing first" + pendingWith "Still need to write this" describe "Player" $ do it "cannot die" $ do @@ -144,7 +144,7 @@ spec = do describe "Entities" $ do it "Simple entity" $ do - pendingWith "fix parsing first" + pendingWith "still need to write this" describe "Level" $ do it "Simple layout" $ do