Add forgotten files, many updates concerning turrets and shields

This commit is contained in:
2021-11-05 19:58:55 +00:00
parent 2c768845b2
commit 5a52b646e1
21 changed files with 380 additions and 34 deletions
+8 -4
View File
@@ -33,9 +33,7 @@ import System.Random
update :: World -> World
update = (frameClock +~ 1) . functionalUpdate
{- |
The update step.
{- | The update step.
For most menus the only way to change the world is using event handling. -}
functionalUpdate :: World -> World
functionalUpdate w = case _menuLayers w of
@@ -149,10 +147,16 @@ updateProjectiles w = IM.foldl' (flip $ dbArg _pjUpdate) w $ _props w
{- Apply internal particle updates, delete 'Nothing's. -}
updateParticles :: World -> World
updateParticles w = set particles (catMaybes ps) w'
updateParticles w = updateInstantParticles $ set particles (catMaybes ps) w'
where
(w',ps) = mapAccumR (\a b -> _ptUpdate b a b) w $ _particles w
updateInstantParticles :: World -> World
updateInstantParticles w = case _instantParticles w of
[] -> w
ps -> let (w',ps') = mapAccumR (\a b -> _ptUpdate b a b) (w {_instantParticles=[]}) ps
in updateInstantParticles $ w' & particles %~ (catMaybes ps' ++)
updateMachines :: World -> World
updateMachines w = foldr f w (_machines w)
where