From 3db46e2436ff84d251c7253c11e68ac3c1e40e62 Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 13 Nov 2018 20:15:29 +0100 Subject: [PATCH] fix error in coordinate translation --- src/MainGame/WorldMap.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/MainGame/WorldMap.hs b/src/MainGame/WorldMap.hs index 0435099..fbfda89 100644 --- a/src/MainGame/WorldMap.hs +++ b/src/MainGame/WorldMap.hs @@ -300,7 +300,7 @@ movePlayer2 (ActionMessage (UpDown f) _) = do emap allEnts $ do with player V2 vx _ <- query xyvel - let ry = fromIntegral f / 32768 :: Double + let ry = fromIntegral f / if f < 0 then 32768 :: Double else 32767 :: Double return $ unchanged { xyvel = Set $ V2 vx ry } @@ -313,7 +313,7 @@ movePlayer2 (ActionMessage (LeftRight f) _) = do emap allEnts $ do with player V2 _ vy <- query xyvel - let rx = fromIntegral f / 32768 :: Double + let rx = fromIntegral f / if f < 0 then 32768 :: Double else 32767 :: Double return $ unchanged { xyvel = Set $ V2 rx vy } @@ -630,8 +630,7 @@ updateMap dt = do with xyvel with vel V2 rx ry <- query xyvel - let dr = (ry / sin (atan (1/2)) / 2) + rx - dc = rx - (ry / sin (atan (1/2)) / 2) + let V2 dr dc = fmap (* 1.5) (V2 rx ry `rotVec` 45) return $ unchanged { vel = Set $ 2 * V2 dr dc }