Move wall damages to external position

This commit is contained in:
2022-06-19 15:05:12 +01:00
parent f2d6504634
commit a7e6d6f3cc
14 changed files with 47 additions and 18 deletions
+4
View File
@@ -22,6 +22,7 @@ module Dodge.Base.Collide
, collidePointWalls
, collidePointWallsNorm
, collidePointWalls'
, collidePointWallsFilt'
, overlapCircWallsReturnWall
, collideCircCrsPoint
, collideCircCreatures
@@ -373,6 +374,9 @@ 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
collidePointWallsFilt' t p1 p2 = collidePointWalls p1 p2 . IM.filter t
-- | Looks for first collision of a circle with walls.
-- If found, gives point and reflection velocity, reflection damped in normal.
-- note that the "intersection" point is the center of the circle flush against the wall