more fix
This commit is contained in:
parent
8023f93ce7
commit
4405539bd8
1 changed files with 6 additions and 5 deletions
11
src/Test.hs
11
src/Test.hs
|
@ -180,7 +180,7 @@ 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) minrs &&
|
if any (\maxr -> pr <= (fromIntegral (floor pr :: Int)) + maxr) maxrs &&
|
||||||
any (\minc -> pc >= (fromIntegral (floor pc :: Int)) + minc) mincs
|
any (\minc -> pc >= (fromIntegral (floor pc :: Int)) + minc) mincs
|
||||||
then do
|
then do
|
||||||
drawPlayer
|
drawPlayer
|
||||||
|
@ -195,6 +195,7 @@ drawTile ai ctx pr pc row col img =
|
||||||
minrs = Prelude.map (fst . matmin) mb
|
minrs = Prelude.map (fst . matmin) mb
|
||||||
maxrs = Prelude.map (fst . matmax) mb
|
maxrs = Prelude.map (fst . matmax) mb
|
||||||
mincs = Prelude.map (snd . matmin) mb
|
mincs = Prelude.map (snd . matmin) mb
|
||||||
|
maxcs = Prelude.map (snd . matmax) mb
|
||||||
x = realToFrac $ 640 + ((fromIntegral col - pc) +
|
x = realToFrac $ 640 + ((fromIntegral col - pc) +
|
||||||
(fromIntegral row - pr)) * (tileWidth / 2)
|
(fromIntegral row - pr)) * (tileWidth / 2)
|
||||||
y = realToFrac $ 360 - (tileHeight / 2) + ((fromIntegral row - pr) -
|
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))
|
dist = distance (V2 (fromIntegral row) (fromIntegral col))
|
||||||
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4
|
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4
|
||||||
fact =
|
fact =
|
||||||
if (pr <= fromIntegral row + maximum maxrs &&
|
if (pr <= fromIntegral row + minimum maxrs &&
|
||||||
pc >= fromIntegral col + minimum mincs) &&
|
pc >= fromIntegral col + maximum mincs) &&
|
||||||
isWall (fromJust img)
|
isWall (fromJust img)
|
||||||
then min 1 dist
|
then min 1 dist
|
||||||
else 1
|
else 1
|
||||||
|
@ -255,11 +256,11 @@ 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
|
||||||
|
|
Loading…
Reference in a new issue