fix view update issue

This commit is contained in:
nek0 2021-05-01 22:27:18 +02:00
parent 2e25c4cfcc
commit 25b6eb659d
2 changed files with 12 additions and 8 deletions

View file

@ -25,13 +25,6 @@ singleHandler level event = do
changeDirection cat state = changeDirection cat state =
Just cat Just cat
{ pcMoveState = if multiplier > 0 then Just state else Nothing { pcMoveState = if multiplier > 0 then Just state else Nothing
, pcViewDirection = if multiplier > 0 && pcGrounded cat
then
if state == MoveRight
then ViewRight
else ViewLeft
else
pcViewDirection cat
} }
liftIO $ atomically $ modifyTVar (testPlayer level) (\(Just pituicat) -> liftIO $ atomically $ modifyTVar (testPlayer level) (\(Just pituicat) ->
A.log Debug ("Grounded: " <> fromString (show $ pcGrounded pituicat)) $ A.log Debug ("Grounded: " <> fromString (show $ pcGrounded pituicat)) $

View file

@ -133,7 +133,18 @@ instance Actor Pituicat where
(pcEffects p) (pcEffects p)
} }
in in
A.log A.Debug ("*meow* am at: " <> (fromString $ show $ pcPos finalCat)) finalCat A.log A.Debug ("*meow* am at: " <> (fromString $ show $ pcPos finalCat))
(finalCat
{ pcViewDirection = if pcGrounded finalCat
then
case pcMoveState finalCat of
Just MoveRight -> ViewRight
Just MoveLeft -> ViewLeft
_ -> pcViewDirection finalCat
else
pcViewDirection finalCat
}
)
instance Mass Pituicat where instance Mass Pituicat where