#18 Started conversion to Game

This commit is contained in:
Tibo De Peuter 2022-12-20 19:53:40 +01:00
parent d4fbcda73b
commit de02c7113f
11 changed files with 300 additions and 112 deletions

View file

@ -16,7 +16,7 @@ data Level = Level {
layout :: Layout,
items :: [Item],
entities :: [Entity]
}
} deriving (Eq, Show)
type Layout = [Strip]
type Strip = [Physical]
@ -26,14 +26,14 @@ data Physical = Void
| Blocked
| Entrance
| Exit
deriving (Show, Eq)
deriving (Eq, Show)
------------------------------- Player -------------------------------
data Player = Player {
playerHp :: Maybe Int,
inventory :: [Item]
}
} deriving (Eq, Show)
instance Living Player where
hp = playerHp
@ -70,7 +70,7 @@ data Item = Item {
itemActions :: [([Condition], Action)],
itemValue :: Maybe Int,
useTimes :: Maybe Int
}
} deriving (Eq, Show)
instance Object Item where
id = itemId
@ -90,8 +90,8 @@ data Entity = Entity {
entityActions :: [([Condition], Action)],
entityValue :: Maybe Int,
entityHp :: Maybe Int,
direction :: Maybe Direction
}
direction :: Direction
} deriving (Eq, Show)
instance Object Entity where
id = entityId