This commit is contained in:
nek0 2018-03-08 17:23:14 +01:00
parent ad18d241aa
commit b79c50b491

View file

@ -187,14 +187,16 @@ drawTile ai ctx pr pc row col img =
drawImage drawImage
drawPlayer drawPlayer
else do else do
if any (\minr -> pr <= (fromIntegral (floor pr :: Int)) + minr) maxrs && if (all (\m -> pr > (fromIntegral (floor pr :: Int)) + m) minrs &&
any (\maxc -> pc >= (fromIntegral (floor pc :: Int)) + maxc) mincs all (\m -> pc < (fromIntegral (floor pc :: Int)) + m) mincs) ||
(all (\m -> pr > (fromIntegral (floor pr :: Int)) + m) minrs &&
all (\m -> pc < (fromIntegral (floor pc :: Int)) + m) maxcs)
then do then do
drawPlayer
drawImage drawImage
drawPlayer
else do else do
drawImage
drawPlayer drawPlayer
drawImage
restore ctx restore ctx
where where
tileWidth = 64 :: Double tileWidth = 64 :: Double
@ -263,19 +265,19 @@ checkBoundsCollision
where where
ntestr ntestr
| ndistr <= hheight + 0.07 = True | ndistr <= hheight + 0.07 = True
-- | ncdistsq <= 0.005 = True | ncdistsq <= 0.005 = True
| otherwise = False | otherwise = False
ntestc ntestc
| ndistc <= hwidth + 0.07 = True | ndistc <= hwidth + 0.07 = True
-- | ncdistsq <= 0.005 = True | ncdistsq <= 0.005 = True
| otherwise = False | otherwise = False
testr testr
| distr <= hheight + 0.07 = True | distr <= hheight + 0.07 = True
-- | cdistsq <= 0.005 = True | cdistsq <= 0.005 = True
| otherwise = False | otherwise = False
testc testc
| distc <= hwidth + 0.07 = True | distc <= hwidth + 0.07 = True
-- | cdistsq <= 0.005 = True | cdistsq <= 0.005 = True
| otherwise = False | otherwise = False
ndistr = abs (fr - (fromIntegral (floor fr :: Int) + (minr + hheight))) ndistr = abs (fr - (fromIntegral (floor fr :: Int) + (minr + hheight)))
ndistc = abs (fc - (fromIntegral (floor fc :: Int) + (minc + hwidth))) ndistc = abs (fc - (fromIntegral (floor fc :: Int) + (minc + hwidth)))