Modularise shockwaves, stop landing self damage when blinking

This commit is contained in:
jgk
2021-04-04 20:19:45 +02:00
parent b3649597fa
commit dfee9b2f37
8 changed files with 144 additions and 140 deletions
+14 -11
View File
@@ -115,17 +115,20 @@ ratIntersectLineLine a b c d = fmap toNumPoint2 $ myIntersectLineLine (toRatPoin
toNumPoint2 (x,y) = (fromRational x, fromRational y)
f = toRatPoint2 . roundPoint2
-- | Round the floats within a 'Point2' to the nearest integer.
-- Rounding jumps after intervals of .5:
--
-- >>> roundPoint (0.5,0.5001)
-- (0.0,1.0)
--
-- but is symmetric around 0:
--
-- >>> roundPoint2 (0.5,-0.5)
-- (0.0,0.0)
--
{- | Round the floats within a 'Point2' to the nearest integer.
__Examples__
Rounding jumps after intervals of .5:
>>> roundPoint (0.5,0.5001)
(0.0,1.0)
but is symmetric around 0:
>>> roundPoint2 (0.5,-0.5)
(0.0,0.0)
-}
roundPoint2 :: Point2 -> Point2
roundPoint2 (x,y) = (fromIntegral $ round x,fromIntegral $ round y)