Partially implement separate blocks
This commit is contained in:
+18
-1
@@ -11,7 +11,7 @@ import Dodge.Config.Data
|
||||
import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.WallCreatureCollisions
|
||||
import Dodge.LevelGen.Block
|
||||
--import Dodge.LevelGen.Block
|
||||
import Dodge.Update.Camera
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Inventory
|
||||
@@ -80,6 +80,23 @@ functionalUpdate w = case _menuLayers w of
|
||||
where
|
||||
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
|
||||
|
||||
updateBlocks :: World -> World
|
||||
updateBlocks w = foldr f w $ _blocks w
|
||||
where
|
||||
f bl w'
|
||||
| head (_blHPs bl) < 1 = w'
|
||||
& blocks %~ IM.delete (_blID bl)
|
||||
& walls %~ removeIDs (_blWallIDs bl)
|
||||
-- & flip (foldr removeFromZone) (_blWallIDs bl)
|
||||
| otherwise = w'
|
||||
removeIDs is wls = foldr IM.delete wls is
|
||||
--removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y) (IM.delete (_wlID wl)) w'
|
||||
removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y . ix (_wlID wl)) setCol w'
|
||||
where
|
||||
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
||||
wl = _walls w' IM.! wlid
|
||||
setCol = wlColor .~ V4 1 1 0 1
|
||||
|
||||
-- | Note the explict use of record syntax. Using lens creates a space leak.
|
||||
resetWorldEvents :: World -> World
|
||||
resetWorldEvents w = w {_worldEvents = id}
|
||||
|
||||
Reference in New Issue
Block a user