Allow for door destruction

This commit is contained in:
2022-06-19 20:50:03 +01:00
parent 9e311cccf4
commit 08e5df07e2
14 changed files with 82 additions and 42 deletions
+3
View File
@@ -366,15 +366,18 @@ collidePointAnyWallsReflect p1 p2
-- If found, gives collision point
-- If not found, returns point
collidePointWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Point2
{-# INLINE collidePointWalls #-}
collidePointWalls p1 p2 = foldr findPoint p2 . fmap _wlLine
where
findPoint (x,y) p = fromMaybe p $ intersectSegSeg p1 p x y
collidePointWalls' :: Point2 -> Point2 -> IM.IntMap Wall -> Point2
{-# INLINE collidePointWalls' #-}
collidePointWalls' p1 p2 = foldl' findPoint p2 . fmap _wlLine
where
findPoint p = fromMaybe p . uncurry (intersectSegSeg p1 p)
collidePointWallsFilt' :: (Wall -> Bool) -> Point2 -> Point2 -> IM.IntMap Wall -> Point2
{-# INLINE collidePointWallsFilt' #-}
collidePointWallsFilt' t p1 p2 = collidePointWalls p1 p2 . IM.filter t
-- | Looks for first collision of a circle with walls.