From e444c03c3313f404a18c83724e9cc2a23aea0bad Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 30 Apr 2018 20:34:45 +0200 Subject: [PATCH] simplify collision detection --- src/Test.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Test.hs b/src/Test.hs index 5e2181a..19df1ad 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -305,21 +305,17 @@ checkBoundsCollision | otherwise = V2 (0 * mr) (0 * mc) where ntestr - | ndistr <= hheight + 0.15 = True + = ndistr <= hheight + 0.15 -- | ncdistsq <= 0.005 = True - | otherwise = False ntestc - | ndistc <= hwidth + 0.15 = True + = ndistc <= hwidth + 0.15 -- | ncdistsq <= 0.005 = True - | otherwise = False testr - | distr <= hheight + 0.15 = True + = distr <= hheight + 0.15 -- | cdistsq <= 0.005 = True - | otherwise = False testc - | distc <= hwidth + 0.15 = True + = distc <= hwidth + 0.15 -- | cdistsq <= 0.005 = True - | otherwise = False ndistr = abs (fr - (fromIntegral (floor fr :: Int) + (minr + hheight))) ndistc = abs (fc - (fromIntegral (floor fc :: Int) + (minc + hwidth))) distr = abs (pr - (fromIntegral (floor fr :: Int) + (minr + hheight)))