make tolerance dependant on frame rate

This commit is contained in:
nek0 2019-02-13 12:09:41 +01:00
parent c9dd91927e
commit a3d7ba4dd7
2 changed files with 3 additions and 1 deletions

View file

@ -103,7 +103,7 @@ updateNPCs imgmat ws rrp dt = do
if not (null path)
then do
let itarget = fmap (+ 0.5) (fromIntegral <$> head path) :: V2 Double
if distance pos' itarget < 0.1
if distance pos' itarget < 1.5 * dt
then
return (Nothing, unchanged
{ npcMoveState = Set $ NPCWalking (tail path)

View file

@ -330,6 +330,7 @@ emitJoyActionMessage (MsgJoystickButton time _ but SDL.JoyButtonPressed) = do
case tmap Map.!? (ButtonAction but SDL.JoyButtonPressed) of
Just act -> partEmit t (ActionMessage act time)
_ -> return ()
_ -> return ()
emitJoyActionMessage _ = return ()
emitKbdActionMessage :: KeyboardMessage -> Affection UserData ()
@ -346,6 +347,7 @@ emitKbdActionMessage (MsgKeyboardEvent time _ press False sym) = do
Just (ActRight _) -> partEmit t (ActionMessage (ActRight val) time)
Just act -> when (press == SDL.Pressed) (partEmit t (ActionMessage act time))
_ -> return ()
_ -> return ()
emitKbdActionMessage _ = return ()
fullClean :: Affection UserData ()