aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Map.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-04-17 23:41:35 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-04-17 23:41:35 +0100
commit7a8af18d0e1003c26eb595b5faa71e51da6286a6 (patch)
treed94ea6897570e12d9c044c40e82e9c05921ba64d /src/Game/Map.hs
parentd333eca8c0761e39781af0711a54044cd5ea3c10 (diff)
downloadspace-plat-hs-7a8af18d0e1003c26eb595b5faa71e51da6286a6.tar.gz
space-plat-hs-7a8af18d0e1003c26eb595b5faa71e51da6286a6.zip
Added new shooter enemy
Diffstat (limited to 'src/Game/Map.hs')
-rw-r--r--src/Game/Map.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Game/Map.hs b/src/Game/Map.hs
index 9616971..1d395dc 100644
--- a/src/Game/Map.hs
+++ b/src/Game/Map.hs
@@ -43,6 +43,7 @@ data Object
| BatteryEntity Int Int
| SlimeEntity Int Int Dir
| RobotEntity Int Int Dir
+ | ShooterEntity Int Int Dir
deriving (Show, Eq, Ord)
data JsonMapData = JsonMapData
@@ -86,10 +87,14 @@ instance JSON Object where
SlimeEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirRight
Just "Robot" ->
RobotEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirRight
+ Just "Shooter" ->
+ ShooterEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirRight
Just "Slime-l" ->
SlimeEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirLeft
Just "Robot-l" ->
RobotEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirLeft
+ Just "Shooter-l" ->
+ ShooterEntity <$> valFromObj "x" obj <*> valFromObj "y" obj <*> pure DirLeft
Just (JSString (JSONString s)) -> Error $ "unsupported entity " ++ show s
e -> Error $ "unsupported entity in " ++ show e
readJSON _ = mzero