diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-03-26 08:49:35 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-03-26 08:49:35 +0100 |
commit | 449dc21f1b48648c5e4abf1a6cace21176fa2226 (patch) | |
tree | 18b67359934694de20199e207dd0c9b33990e945 /src/Game/Entities | |
parent | 11d2ed7f15a86dd465bc3456e3478e9ff03bf5d2 (diff) | |
download | space-plat-hs-449dc21f1b48648c5e4abf1a6cace21176fa2226.tar.gz space-plat-hs-449dc21f1b48648c5e4abf1a6cace21176fa2226.zip |
Support entities facing left
Perhaps it would be better to support "custom properties" in tiled, but
this is OK for now.
Diffstat (limited to 'src/Game/Entities')
-rw-r--r-- | src/Game/Entities/Robot.hs | 8 | ||||
-rw-r--r-- | src/Game/Entities/Slime.hs | 6 | ||||
-rw-r--r-- | src/Game/Entities/Types.hs | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Game/Entities/Robot.hs b/src/Game/Entities/Robot.hs index 44fc310..664079a 100644 --- a/src/Game/Entities/Robot.hs +++ b/src/Game/Entities/Robot.hs @@ -6,8 +6,8 @@ import Game.Entities.Const import Game.Entities.Types import qualified Game.Sprites as S -mkRobot :: S.SpriteSheet -> Int -> Int -> Collision -> IsBlocked -> IO Entity -mkRobot sprites x y playerCollision isBlocked = do +mkRobot :: S.SpriteSheet -> Int -> Int -> Dir -> Collision -> IsBlocked -> IO Entity +mkRobot sprites x y d playerCollision isBlocked = do s <- S.get sprites "robot" pure Entity @@ -16,10 +16,10 @@ mkRobot sprites x y playerCollision isBlocked = do y = y, delay = frameDelay, frame = 0, - set = toSpriteSet DirRight, + set = toSpriteSet d, jumping = False, gravity = gravityOff, - dir = DirRight, + dir = d, sprite = s, update = updateRobot playerCollision isBlocked, destroy = False, diff --git a/src/Game/Entities/Slime.hs b/src/Game/Entities/Slime.hs index c102712..7607fb7 100644 --- a/src/Game/Entities/Slime.hs +++ b/src/Game/Entities/Slime.hs @@ -6,8 +6,8 @@ import Game.Entities.Const import Game.Entities.Types import qualified Game.Sprites as S -mkSlime :: S.SpriteSheet -> Int -> Int -> Collision -> IsBlocked -> IO Entity -mkSlime sprites x y playerCollision isBlocked = do +mkSlime :: S.SpriteSheet -> Int -> Int -> Dir -> Collision -> IsBlocked -> IO Entity +mkSlime sprites x y d playerCollision isBlocked = do s <- S.get sprites "slime" pure Entity @@ -19,7 +19,7 @@ mkSlime sprites x y playerCollision isBlocked = do set = 0, jumping = False, gravity = gravityOff, - dir = DirRight, + dir = d, sprite = s, update = updateSlime playerCollision isBlocked, destroy = False, diff --git a/src/Game/Entities/Types.hs b/src/Game/Entities/Types.hs index 34bddd3..05b419e 100644 --- a/src/Game/Entities/Types.hs +++ b/src/Game/Entities/Types.hs @@ -12,7 +12,7 @@ where import Data.IORef import qualified Game.Sprites as S -data Dir = DirRight | DirLeft deriving (Eq) +data Dir = DirRight | DirLeft deriving (Eq, Show, Ord) data Type = TypePlayer | TypePickup | TypeEffect | TypeEnemy deriving (Eq) |