more entomology
This commit is contained in:
parent
c14c652360
commit
165baa179c
2 changed files with 5 additions and 8 deletions
|
@ -141,7 +141,7 @@ updateNPCs imgmat rp dt =
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return $ defEntity'
|
return $ defEntity'
|
||||||
{ vel = Set $ (* 0.5) <$> signorm (itarget - pos')
|
{ vel = Set $ (* 2) <$> signorm (itarget - pos')
|
||||||
}
|
}
|
||||||
else do
|
else do
|
||||||
ttl <- liftIO $ randomRIO (5, 30)
|
ttl <- liftIO $ randomRIO (5, 30)
|
||||||
|
|
11
src/Test.hs
11
src/Test.hs
|
@ -95,7 +95,7 @@ mouseToPlayer mv2 = do
|
||||||
emap $ do
|
emap $ do
|
||||||
with player
|
with player
|
||||||
pure $ defEntity'
|
pure $ defEntity'
|
||||||
{ vel = Set $ V2 dr dc
|
{ vel = Set $ 4 * V2 dr dc
|
||||||
}
|
}
|
||||||
putAffection ud
|
putAffection ud
|
||||||
{ worldState = nws
|
{ worldState = nws
|
||||||
|
@ -184,7 +184,7 @@ updateMap dt = do
|
||||||
with pos
|
with pos
|
||||||
pos'@(V2 pr pc) <- E.get pos
|
pos'@(V2 pr pc) <- E.get pos
|
||||||
vel' <- E.get vel
|
vel' <- E.get vel
|
||||||
let npos@(V2 nr nc) = pos' + fmap (* (4 * dt)) vel'
|
let npos@(V2 nr nc) = pos' + fmap (* dt) vel'
|
||||||
dpos = npos - pos'
|
dpos = npos - pos'
|
||||||
ent = defEntity'
|
ent = defEntity'
|
||||||
{ pos = Set $ npos
|
{ pos = Set $ npos
|
||||||
|
@ -196,7 +196,7 @@ updateMap dt = do
|
||||||
with pos
|
with pos
|
||||||
pos'@(V2 pr pc) <- E.get pos
|
pos'@(V2 pr pc) <- E.get pos
|
||||||
vel' <- E.get vel
|
vel' <- E.get vel
|
||||||
let npos@(V2 nr nc) = pos' + fmap (* (4 * dt)) vel'
|
let npos@(V2 nr nc) = pos' + fmap (* dt) vel'
|
||||||
dpos@(V2 dpr dpc) = npos - pos'
|
dpos@(V2 dpr dpc) = npos - pos'
|
||||||
len = sqrt (dpos `dot` dpos)
|
len = sqrt (dpos `dot` dpos)
|
||||||
lll = (,)
|
lll = (,)
|
||||||
|
@ -240,7 +240,7 @@ updateMap dt = do
|
||||||
(maxr + fromIntegral dr, maxc + fromIntegral dc)
|
(maxr + fromIntegral dr, maxc + fromIntegral dc)
|
||||||
) bs
|
) bs
|
||||||
)
|
)
|
||||||
lll
|
(A.log A.Debug (show lll ++ " " ++ show len) lll)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return ent
|
return ent
|
||||||
|
@ -373,11 +373,8 @@ 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 < 0 && colltc < 0 = A.log A.Debug (show (colltr, colltc)) (V2 (colltr / dt) (colltc / dt))
|
|
||||||
| (colltr < 0 && colltc < 0) || (inrow && incol) = A.log A.Debug ("both " ++ show (colltr, colltc)) (V2 0 0)
|
| (colltr < 0 && colltc < 0) || (inrow && incol) = A.log A.Debug ("both " ++ show (colltr, colltc)) (V2 0 0)
|
||||||
-- | colltr < 0 && colltc >= dt = (V2 (colltr / dt) 1)
|
|
||||||
| colltr < 0 && incol = (A.log A.Debug ("row fixed " ++ show (colltr, colltc))(V2 0 1)) * acc
|
| colltr < 0 && incol = (A.log A.Debug ("row fixed " ++ show (colltr, colltc))(V2 0 1)) * acc
|
||||||
-- | colltc < 0 && colltc >= dt = (V2 1 (colltr / dt))
|
|
||||||
| colltc < 0 && inrow = (A.log A.Debug ("col fixed " ++ show (colltr, colltc))(V2 1 0)) * acc
|
| colltc < 0 && inrow = (A.log A.Debug ("col fixed " ++ show (colltr, colltc))(V2 1 0)) * acc
|
||||||
| otherwise = acc
|
| otherwise = acc
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue