fix error in coordinate translation

This commit is contained in:
nek0 2018-11-13 20:15:29 +01:00
parent 14a6c48c33
commit 3db46e2436

View file

@ -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
}