aboutsummaryrefslogtreecommitdiff
path: root/src/Game
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-03-02 07:52:51 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-03-02 07:53:16 +0000
commit5dd9180606e935ee5a7c1637773fdfc3277677ca (patch)
treeb1ba4c5e200df62f4d8f56b382c6d96bc8b8d483 /src/Game
parent1b05eefc7a5a4fb688d7b631529324ca08ed1a16 (diff)
downloadspace-plat-hs-5dd9180606e935ee5a7c1637773fdfc3277677ca.tar.gz
space-plat-hs-5dd9180606e935ee5a7c1637773fdfc3277677ca.zip
Clarified comments
Diffstat (limited to 'src/Game')
-rw-r--r--src/Game/Entities.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs
index 4d8b12b..0c1a4f3 100644
--- a/src/Game/Entities.hs
+++ b/src/Game/Entities.hs
@@ -56,13 +56,14 @@ updateAll es = do
updated <- (updatedPlayer :) <$> traverse (updateFilter playerWasHit) others
-- process actions
updated' <- processActions updated (concatMap (\e -> e.actions) updated)
- -- clear spawns (new entities), filter out destroyed entities, and add the new ones
+ -- clear actions, filter out destroyed entities, and add the new ones
pure es {entities = map (\e -> e {actions = []}) (filter (\e -> not e.destroy) updated')}
where
stateRef = es.state
player = head es.entities
others = tail es.entities
+ -- the actions can add new entities of modify existing ones
processActions :: [Entity] -> [Action] -> IO [Entity]
processActions ents (a : t) =
case a of