diff --git a/src/Test.hs b/src/Test.hs index 84ae239..80b5c16 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -180,7 +180,7 @@ drawTile ai ctx pr pc row col img = drawImage drawPlayer else do - if any (\minr -> pr <= (fromIntegral (floor pr :: Int)) + minr) minrs && + if any (\maxr -> pr <= (fromIntegral (floor pr :: Int)) + maxr) maxrs && any (\minc -> pc >= (fromIntegral (floor pc :: Int)) + minc) mincs then do drawPlayer @@ -195,6 +195,7 @@ drawTile ai ctx pr pc row col img = minrs = Prelude.map (fst . matmin) mb maxrs = Prelude.map (fst . matmax) mb mincs = Prelude.map (snd . matmin) mb + maxcs = Prelude.map (snd . matmax) mb x = realToFrac $ 640 + ((fromIntegral col - pc) + (fromIntegral row - pr)) * (tileWidth / 2) y = realToFrac $ 360 - (tileHeight / 2) + ((fromIntegral row - pr) - @@ -202,8 +203,8 @@ drawTile ai ctx pr pc row col img = dist = distance (V2 (fromIntegral row) (fromIntegral col)) (V2 (realToFrac pr - 1) (realToFrac pc)) / 4 fact = - if (pr <= fromIntegral row + maximum maxrs && - pc >= fromIntegral col + minimum mincs) && + if (pr <= fromIntegral row + minimum maxrs && + pc >= fromIntegral col + maximum mincs) && isWall (fromJust img) then min 1 dist else 1 @@ -255,11 +256,11 @@ checkBoundsCollision where ntestr | ndistr <= hheight + 0.07 = True - | ncdistsq <= 0.005 = True + | ncdistsq <= 0.005 = True | otherwise = False ntestc | ndistc <= hwidth + 0.07 = True - | ncdistsq <= 0.005 = True + | ncdistsq <= 0.005 = True | otherwise = False testr | distr <= hheight + 0.07 = True