(no title)
thepratt | 5 years ago
data Demon = { ... }
data Action
= Dead
| KnockedBack
| Polymorphed
class Character a where
health :: Int
class (Character a) => Movement a where
speed :: Int
class (Character a) => Enemy a where
kill :: a -> Action
damage :: a -> Action
instance Character Demon where
health = 30
instance Movement Demon where
speed = 5
instance Enemy Demon where
kill _ = _
damage _ = _
https://soupi.github.io/rfc/pfgames/ is a talk going through an experience building a game in a pure fp way with Haskell and how they modelled certain aspects of game dev. Most of the code examples are when you press down in the slides.
No comments yet.