This commit is contained in:
nek0 2018-03-06 23:04:52 +01:00
parent 8023f93ce7
commit 4405539bd8

View file

@ -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