Remove strafing when not aiming, only move forward
This commit is contained in:
@@ -40,11 +40,13 @@ wasdWithAiming ::
|
||||
Creature
|
||||
wasdWithAiming w speed cr
|
||||
-- | isAiming = addAnyTwist $ set crDir mouseDir $ theMovement cr
|
||||
| isAiming = addAnyTwist $ aimTurn mouseDir $ theMovement cr
|
||||
| isAiming = addAnyTwist $ aimTurn mouseDir $ theMovement $ setMvAim cr
|
||||
| crIsReloading cr && SDL.ButtonRight `M.member` _mouseButtons (_input w) =
|
||||
addAnyTwist $ set crDir (mouseDir + anytwist) $ theMovement cr
|
||||
| otherwise = theMovement $ theTurn $ removeTwist cr
|
||||
addAnyTwist $ aimTurn (mouseDir + anytwist) $ theMovement $ setMvAim cr
|
||||
-- | otherwise = theMovement $ theTurn $ removeTwist $ setMvAim cr
|
||||
| otherwise = noaimmove $ theTurn $ removeTwist $ setMvAim cr
|
||||
where
|
||||
setMvAim = maybe id (crMvAim .~) dir
|
||||
twistamount = 1.6
|
||||
removeTwist cr' =
|
||||
cr'
|
||||
@@ -56,10 +58,14 @@ wasdWithAiming w speed cr
|
||||
addAnyTwist = crTwist .~ anytwist
|
||||
theMovement
|
||||
| movDir == V2 0 0 = id
|
||||
| otherwise = crMvAbsolute (speed *.* movAbs) . set crMvDir dir
|
||||
theTurn cr' = creatureTurnTowardDir (_crMvDir cr') 0.2 cr'
|
||||
| otherwise = crMvAbsolute (speed *.* movAbs)
|
||||
noaimmove
|
||||
| movDir == V2 0 0 = id
|
||||
| otherwise = crMvForward speed
|
||||
theTurn cr' = creatureTurnTowardDir (_crMvAim cr') 0.2 cr'
|
||||
-- theTurn' cr' = creatureTurnTowardDir dir 0.2 cr'
|
||||
movDir = wasdDir w
|
||||
dir = (w ^. cWorld . camPos . camRot) + argV movDir
|
||||
dir = fmap ((w ^. cWorld . camPos . camRot) +) (safeArgV movDir)
|
||||
movAbs = rotateV (w ^. cWorld . camPos . camRot) $ normalizeV movDir
|
||||
isAiming = _posture (_crStance cr) == Aiming
|
||||
mouseDir = case cr ^? crInv . ix (crSel cr) . itScope . scopePos of
|
||||
|
||||
@@ -40,6 +40,7 @@ data Creature = Creature
|
||||
, _crDir :: Float
|
||||
, _crOldDir :: Float
|
||||
, _crMvDir :: Float
|
||||
, _crMvAim :: Float
|
||||
, _crTwist :: Float
|
||||
, _crType :: CreatureType
|
||||
, _crID :: Int
|
||||
|
||||
@@ -17,6 +17,7 @@ defaultCreature =
|
||||
, _crDir = 0
|
||||
, _crOldDir = 0
|
||||
, _crMvDir = 0
|
||||
, _crMvAim = 0
|
||||
, _crTwist = 0
|
||||
, _crID = 1
|
||||
, _crType = defaultCreatureSkin
|
||||
|
||||
Reference in New Issue
Block a user