From 165baa179ca60231564b1fcd7e67048f3832705c Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 13 May 2018 22:01:05 +0200 Subject: [PATCH] more entomology --- src/NPC.hs | 2 +- src/Test.hs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/NPC.hs b/src/NPC.hs index 9d031a1..87fc3d2 100644 --- a/src/NPC.hs +++ b/src/NPC.hs @@ -141,7 +141,7 @@ updateNPCs imgmat rp dt = } else return $ defEntity' - { vel = Set $ (* 0.5) <$> signorm (itarget - pos') + { vel = Set $ (* 2) <$> signorm (itarget - pos') } else do ttl <- liftIO $ randomRIO (5, 30) diff --git a/src/Test.hs b/src/Test.hs index 06bc2b7..2f4b890 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -95,7 +95,7 @@ mouseToPlayer mv2 = do emap $ do with player pure $ defEntity' - { vel = Set $ V2 dr dc + { vel = Set $ 4 * V2 dr dc } putAffection ud { worldState = nws @@ -184,7 +184,7 @@ updateMap dt = do with pos pos'@(V2 pr pc) <- E.get pos 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' ent = defEntity' { pos = Set $ npos @@ -196,7 +196,7 @@ updateMap dt = do with pos pos'@(V2 pr pc) <- E.get pos 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' len = sqrt (dpos `dot` dpos) lll = (,) @@ -240,7 +240,7 @@ updateMap dt = do (maxr + fromIntegral dr, maxc + fromIntegral dc) ) bs ) - lll + (A.log A.Debug (show lll ++ " " ++ show len) lll) ) } return ent @@ -373,11 +373,8 @@ checkBoundsCollision2 -> V2 Double checkBoundsCollision2 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 >= dt = (V2 (colltr / dt) 1) | 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 | otherwise = acc where