cleaning
This commit is contained in:
parent
cc3480c0c0
commit
72c8adb4f5
1 changed files with 14 additions and 10 deletions
24
src/Test.hs
24
src/Test.hs
|
@ -225,7 +225,7 @@ updateMap dt = do
|
||||||
ent = defEntity'
|
ent = defEntity'
|
||||||
{ pos = Set $ pos' + dpos * Prelude.foldl
|
{ pos = Set $ pos' + dpos * Prelude.foldl
|
||||||
(\acc a -> let ret = checkBoundsCollision2 pos' npos dt acc a
|
(\acc a -> let ret = checkBoundsCollision2 pos' npos dt acc a
|
||||||
in A.log A.Debug (show ret) ret)
|
in A.log A.Verbose (show ret) ret)
|
||||||
(V2 1 1)
|
(V2 1 1)
|
||||||
(
|
(
|
||||||
concatMap
|
concatMap
|
||||||
|
@ -240,7 +240,7 @@ updateMap dt = do
|
||||||
(maxr + fromIntegral dr, maxc + fromIntegral dc)
|
(maxr + fromIntegral dr, maxc + fromIntegral dc)
|
||||||
) bs
|
) bs
|
||||||
)
|
)
|
||||||
(A.log A.Debug (show lll ++ " " ++ show len) lll)
|
(A.log A.Verbose (show lll ++ " " ++ show len) lll)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return ent
|
return ent
|
||||||
|
@ -373,19 +373,23 @@ checkBoundsCollision2
|
||||||
-> V2 Double
|
-> V2 Double
|
||||||
checkBoundsCollision2
|
checkBoundsCollision2
|
||||||
pre@(V2 pr pc) next@(V2 nr nc) dt acc (Boundaries (minr, minc) (maxr, maxc))
|
pre@(V2 pr pc) next@(V2 nr nc) dt acc (Boundaries (minr, minc) (maxr, maxc))
|
||||||
| colltr < dt && colltc < dt = A.log A.Debug ("both " ++ show (colltr, colltc)) (V2 0 0)
|
| colltr < dt && colltc < dt = V2 0 0
|
||||||
| colltr < dt && incol = (A.log A.Debug ("row fixed " ++ show (colltr, colltc))(V2 0 1)) * acc
|
| colltr < dt && incol = V2 0 1 * acc
|
||||||
| colltc < dt && inrow = (A.log A.Debug ("col fixed " ++ show (colltr, colltc))(V2 1 0)) * acc
|
| colltc < dt && inrow = V2 1 0 * acc
|
||||||
| otherwise = acc
|
| otherwise = acc
|
||||||
where
|
where
|
||||||
vel@(V2 vr vc) = fmap (/ dt) (next - pre)
|
vel@(V2 vr vc) = fmap (/ dt) (next - pre)
|
||||||
colltr
|
colltr
|
||||||
| vr > 0 && prr <= maxr = (((fromIntegral (floor pr :: Int)) + minr - 0.15) - pr) / vr
|
| vr > 0 && prr <= maxr =
|
||||||
| vr < 0 && prr >= minr = (((fromIntegral (floor pr :: Int)) + maxr + 0.15) - pr) / vr
|
(((fromIntegral (floor pr :: Int)) + minr - 0.15) - pr) / vr
|
||||||
|
| vr < 0 && prr >= minr =
|
||||||
|
(((fromIntegral (floor pr :: Int)) + maxr + 0.15) - pr) / vr
|
||||||
| otherwise = dt
|
| otherwise = dt
|
||||||
colltc
|
colltc
|
||||||
| vc > 0 && prc <= maxc = (((fromIntegral (floor pc :: Int)) + minc - 0.15) - pc) / vc
|
| vc > 0 && prc <= maxc =
|
||||||
| vc < 0 && prc >= minc = (((fromIntegral (floor pc :: Int)) + maxc + 0.15) - pc) / vc
|
(((fromIntegral (floor pc :: Int)) + minc - 0.15) - pc) / vc
|
||||||
|
| vc < 0 && prc >= minc =
|
||||||
|
(((fromIntegral (floor pc :: Int)) + maxc + 0.15) - pc) / vc
|
||||||
| otherwise = dt
|
| otherwise = dt
|
||||||
inrow = pr > minr && pr < maxr
|
inrow = pr > minr && pr < maxr
|
||||||
incol = pc > minc && pc < maxc
|
incol = pc > minc && pc < maxc
|
||||||
|
|
Loading…
Reference in a new issue