module Game.Entities.Types ( Dir (..), Type (..), Collision, IsBlocked, Entities (..), Action (..), Entity (..), ) where import Data.IORef import qualified Game.Sprites as S data Dir = DirRight | DirLeft | Dying deriving (Eq) data Type = TypePlayer | TypePickup | TypeEffect | TypeEnemy deriving (Eq) type Collision = Entity -> IO Bool type IsBlocked = Int -> Int -> Bool data Entities = Entities { sprites :: S.SpriteSheet, player :: IORef Entity, entities :: [Entity] } -- | The effect name must match the sprite name in the spritesheet. type EffectName = String data Action = ActionAddEffect Int Int EffectName | ActionAddBattery Int Int | ActionHitPlayer | ActionExitStarted | ActionEntryDone | ActionExitDone data Entity = Entity { typ :: Type, x :: Int, y :: Int, delay :: Int, frame :: Int, jumping :: Bool, gravity :: Int, dir :: Dir, sprite :: S.Sprite, update :: Entity -> IO Entity, destroy :: Bool, actions :: [Action] }