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
drawPlayer
else do
if any (\minr -> pr <= (fromIntegral (floor pr :: Int)) + minr) maxrs &&
any (\maxc -> pc >= (fromIntegral (floor pc :: Int)) + maxc) mincs
if (all (\m -> pr > (fromIntegral (floor pr :: Int)) + m) minrs &&
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
drawPlayer
drawImage
drawPlayer
else do
drawImage
drawPlayer
drawImage
restore ctx
where
tileWidth = 64 :: Double
@ -263,19 +265,19 @@ 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
-- | cdistsq <= 0.005 = True
| cdistsq <= 0.005 = True
| otherwise = False
testc
| distc <= hwidth + 0.07 = True
-- | cdistsq <= 0.005 = True
| cdistsq <= 0.005 = True
| otherwise = False
ndistr = abs (fr - (fromIntegral (floor fr :: Int) + (minr + hheight)))
ndistc = abs (fc - (fromIntegral (floor fc :: Int) + (minc + hwidth)))