aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Map.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-02-26 00:26:54 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-02-26 00:26:54 +0000
commit9b04633e09a80d33456f545baf1fa910f0986db7 (patch)
tree28554c66d557cb16b1281f07abb9c083aca12589 /src/Game/Map.hs
parentb3e0ace3ca198cacd8d77c6ca0f2c457826dee63 (diff)
downloadspace-plat-hs-9b04633e09a80d33456f545baf1fa910f0986db7.tar.gz
space-plat-hs-9b04633e09a80d33456f545baf1fa910f0986db7.zip
Draw the HUB on the top of the screen
Diffstat (limited to 'src/Game/Map.hs')
-rw-r--r--src/Game/Map.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Game/Map.hs b/src/Game/Map.hs
index 47dc31c..e1dd673 100644
--- a/src/Game/Map.hs
+++ b/src/Game/Map.hs
@@ -2,6 +2,7 @@ module Game.Map
( Map (..),
Object (..),
objects,
+ height,
totalBatteries,
load,
render,
@@ -154,6 +155,9 @@ isPlayer :: Object -> Bool
isPlayer (PlayerEntity _ _) = True
isPlayer _ = False
+height :: Map -> Int
+height (Map md _) = md.height * md.tileset.height
+
-- | Return the number of batteries in a map.
totalBatteries :: Map -> Int
totalBatteries m = length $ filter isBattery (objects m)