fix error in coordinate translation
This commit is contained in:
parent
14a6c48c33
commit
3db46e2436
1 changed files with 3 additions and 4 deletions
|
@ -300,7 +300,7 @@ movePlayer2 (ActionMessage (UpDown f) _) = do
|
||||||
emap allEnts $ do
|
emap allEnts $ do
|
||||||
with player
|
with player
|
||||||
V2 vx _ <- query xyvel
|
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
|
return $ unchanged
|
||||||
{ xyvel = Set $ V2 vx ry
|
{ xyvel = Set $ V2 vx ry
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ movePlayer2 (ActionMessage (LeftRight f) _) = do
|
||||||
emap allEnts $ do
|
emap allEnts $ do
|
||||||
with player
|
with player
|
||||||
V2 _ vy <- query xyvel
|
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
|
return $ unchanged
|
||||||
{ xyvel = Set $ V2 rx vy
|
{ xyvel = Set $ V2 rx vy
|
||||||
}
|
}
|
||||||
|
@ -630,8 +630,7 @@ updateMap dt = do
|
||||||
with xyvel
|
with xyvel
|
||||||
with vel
|
with vel
|
||||||
V2 rx ry <- query xyvel
|
V2 rx ry <- query xyvel
|
||||||
let dr = (ry / sin (atan (1/2)) / 2) + rx
|
let V2 dr dc = fmap (* 1.5) (V2 rx ry `rotVec` 45)
|
||||||
dc = rx - (ry / sin (atan (1/2)) / 2)
|
|
||||||
return $ unchanged
|
return $ unchanged
|
||||||
{ vel = Set $ 2 * V2 dr dc
|
{ vel = Set $ 2 * V2 dr dc
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue