Add IntMapHelper, locate wall cutting bug

This commit is contained in:
jgk
2021-05-22 15:14:21 +02:00
parent 26f0ca4ab5
commit 9c2bcbec10
35 changed files with 221 additions and 139 deletions
+5 -5
View File
@@ -1,13 +1,12 @@
module Dodge.Debug where
import Dodge.Data
import Dodge.Base
import Dodge.Picture
import Dodge.Picture.Layer
--import Geometry.Data
import Picture
import qualified IntMapHelp as IM
import Control.Lens
import qualified Data.IntMap.Strict as IM
drawCircleAtFor :: Point2 -> Int -> World -> World
drawCircleAtFor p t w = w & projectiles %~
@@ -20,7 +19,7 @@ drawCircleAtFor p t w = w & projectiles %~
, _pjUpdate = pjTimer t k
}
where
k = newKey $ _projectiles w
k = IM.newKey $ _projectiles w
drawCircleAtForCol :: Point2 -> Int -> Color -> World -> World
drawCircleAtForCol p t col w = w & projectiles %~
IM.insert k Projectile
@@ -32,7 +31,7 @@ drawCircleAtForCol p t col w = w & projectiles %~
, _pjUpdate = pjTimer t k
}
where
k = newKey $ _projectiles w
k = IM.newKey $ _projectiles w
drawLineForCol :: [Point2] -> Int -> Color -> World -> World
drawLineForCol ps t col w = w & projectiles %~
IM.insert k Projectile
@@ -44,8 +43,9 @@ drawLineForCol ps t col w = w & projectiles %~
, _pjUpdate = pjTimer t k
}
where
k = newKey $ _projectiles w
k = IM.newKey $ _projectiles w
pjTimer :: Int -> Int -> World -> World
pjTimer 0 i = projectiles %~ IM.delete i
pjTimer time i = projectiles . ix i . pjUpdate .~ pjTimer (time - 1) i