diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-04-17 23:41:35 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-04-17 23:41:35 +0100 |
commit | 7a8af18d0e1003c26eb595b5faa71e51da6286a6 (patch) | |
tree | d94ea6897570e12d9c044c40e82e9c05921ba64d /src/Game/Entities.hs | |
parent | d333eca8c0761e39781af0711a54044cd5ea3c10 (diff) | |
download | space-plat-hs-7a8af18d0e1003c26eb595b5faa71e51da6286a6.tar.gz space-plat-hs-7a8af18d0e1003c26eb595b5faa71e51da6286a6.zip |
Added new shooter enemy
Diffstat (limited to 'src/Game/Entities.hs')
-rw-r--r-- | src/Game/Entities.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs index 6506a60..25a7184 100644 --- a/src/Game/Entities.hs +++ b/src/Game/Entities.hs @@ -16,6 +16,7 @@ import Data.Foldable (find, traverse_) import Data.IORef import Data.List (sort) import qualified Game.Controller as C +import Game.Entities.Blast import Game.Entities.Common import Game.Entities.Const import Game.Entities.Effect @@ -24,6 +25,7 @@ import Game.Entities.Exit import Game.Entities.Pickup import Game.Entities.Player import Game.Entities.Robot +import Game.Entities.Shooter import Game.Entities.Slime import Game.Entities.Types import qualified Game.Map as M @@ -46,6 +48,7 @@ mkEntities sprites m controls = do toEntity :: IORef Entity -> M.Object -> IO Entity toEntity playerRef (M.SlimeEntity x y d) = mkSlime sprites x y d (collision playerRef 16) (M.isBlocked m) toEntity playerRef (M.RobotEntity x y d) = mkRobot sprites x y d (collision playerRef 24) (M.isBlocked m) + toEntity playerRef (M.ShooterEntity x y d) = mkShooter sprites x y d (collision playerRef 24) (inLine playerRef 24) (M.isBlocked m) (collision playerRef 8) toEntity playerRef (M.BatteryEntity x y) = mkBattery sprites x y (collision playerRef 16) toEntity _ (M.PlayerEntity _ _) = error "Player already processed" @@ -110,6 +113,9 @@ updateAll es state = do t ActionEntryDone -> processActions s {GS.levelCompleted = GS.ExitOff} ents t ActionExitDone -> processActions s {GS.levelCompleted = GS.ExitDone} ents t + ActionAddBlast x y d playerCollision isBlocked -> do + blast <- mkBlast es.sprites x y d playerCollision isBlocked + processActions s (ents ++ [blast]) t processActions s ents [] = pure (s, ents) -- Update entities skipping enemies if the player was hit |