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