#10 #18 Fix parsing

This commit is contained in:
Tibo De Peuter 2022-12-22 22:05:25 +01:00
parent 5cc96cbdba
commit f3bce99120
18 changed files with 289 additions and 103 deletions

View file

@ -9,7 +9,7 @@ import RPGEngine.Config ( bgColor, winDimensions, winOffsets )
import RPGEngine.Render ( initWindow, render )
import RPGEngine.Input ( handleAllInput )
import RPGEngine.Input.Playing ( checkPlaying, spawnPlayer )
import RPGEngine.Data (Game (..), State (..), Layout, Level (..), Physical (..))
import RPGEngine.Data (Game (..), State (..), Layout, Level (..), Physical (..), Entity(..), Direction(..), Player(..))
import RPGEngine.Data.Default (defaultLevel, defaultPlayer)
import Graphics.Gloss ( play )
@ -27,22 +27,15 @@ playRPGEngine title fps = do
-- TODO revert this
-- Initialize the game
initGame :: Game
-- initGame = Game {
-- state = Menu{ base = StateBase{
-- renderer = renderMenu,
-- inputHandler = handleInputMenu
-- }}
-- }
initGame = Game{
state = initState
}
where initState = Playing{
levels = [defaultLevel, otherLevel],
count = 0,
level = defaultLevel,
player = spawnPlayer defaultLevel defaultPlayer,
restart = initState
}
initGame = Game { state = Menu }
-- initGame = Game{ state = initState }
-- where initState = Playing{
-- levels = [defaultLevel, otherLevel],
-- count = 0,
-- level = defaultLevel,
-- player = spawnPlayer defaultLevel defaultPlayer,
-- restart = initState
-- }
-- TODO remove this
otherLayout :: Layout
@ -50,6 +43,8 @@ otherLayout = [
[Blocked, Blocked, Blocked],
[Blocked, Entrance, Blocked],
[Blocked, Walkable, Blocked],
[Blocked, Walkable, Blocked],
[Blocked, Walkable, Blocked],
[Blocked, Exit, Blocked],
[Blocked, Blocked, Blocked]
]
@ -69,12 +64,30 @@ otherLevel = Level {
(1, 2, Walkable),
(2, 2, Blocked),
(0, 3, Blocked),
(1, 3, Exit),
(1, 3, Walkable),
(2, 3, Blocked),
(0, 4, Blocked),
(1, 4, Blocked),
(2, 4, Blocked)
(1, 4, Walkable),
(2, 4, Blocked),
(0, 5, Blocked),
(1, 5, Exit),
(2, 5, Blocked),
(0, 6, Blocked),
(1, 6, Blocked),
(2, 6, Blocked)
],
items = [],
entities = []
entities = [
Entity{
entityId = "door",
entityX = 1,
entityY = 3,
entityName = "Epic door",
entityDescription = "epic description",
entityActions = [],
entityValue = Nothing,
entityHp = Nothing,
direction = North
}
]
}