fix movement

This commit is contained in:
nek0 2018-11-16 07:12:27 +01:00
parent 040a878b41
commit 702fa633c3
2 changed files with 6 additions and 4 deletions

View file

@ -20,7 +20,7 @@ import Types
import MainGame.WorldMap (checkBoundsCollision2, drawTile) import MainGame.WorldMap (checkBoundsCollision2, drawTile)
import Util (direction) import Util
updateMind :: Double -> Affection UserData () updateMind :: Double -> Affection UserData ()
updateMind dt = do updateMind dt = do
@ -31,8 +31,9 @@ updateMind dt = do
with xyvel with xyvel
with mmvel with mmvel
V2 rx ry <- query xyvel V2 rx ry <- query xyvel
let dr = (ry / sin (atan (1/2)) / 2) + rx -- let dr = (ry / sin (atan (1/2)) / 2) + rx
dc = rx - (ry / sin (atan (1/2)) / 2) -- dc = rx - (ry / sin (atan (1/2)) / 2)
let V2 dr dc = fmap (* 1.5) (V2 rx ry `rotVec` 45)
return $ unchanged return $ unchanged
{ mmvel = Set $ 2 * V2 dr dc { mmvel = Set $ 2 * V2 dr dc
} }

View file

@ -781,7 +781,8 @@ updateMap dt = do
then [(floor dpc :: Int) .. 0] then [(floor dpc :: Int) .. 0]
else [0 .. (ceiling dpc :: Int)]) else [0 .. (ceiling dpc :: Int)])
colldpos = dpos * Prelude.foldl colldpos = dpos * Prelude.foldl
(\acc a -> let ret = checkBoundsCollision2 pos' npos dt acc a (\acc a ->
let ret = checkBoundsCollision2 pos' npos dt acc a
in A.log A.Verbose (show ret) ret) in A.log A.Verbose (show ret) ret)
(V2 1 1) (V2 1 1)
( (