Allow modifiable speed changes

This commit is contained in:
Ross
2021-03-26 14:20:13 +00:00
parent fb1d7571e7
commit fb17502781
4 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -1878,8 +1878,8 @@ yourControl :: World -> (World -> World,StdGen) -> Creature -> ((World -> World,
yourControl w (f,g) cr = ( (updateUsingInput . f, g)
, Just . crAutoReload . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed strafeSpeed 0 cr
)
where strafeSpeed = 8 * equipFactor * (fromMaybe 1 $ yourItem w ^? itAimingSpeed)
speed = 3 * equipFactor
where strafeSpeed = _varMovementStrafeSpeedModifier w * equipFactor * (fromMaybe 1 $ yourItem w ^? itAimingSpeed)
speed = _varMovementSpeedModifier w * equipFactor
equipFactor = product $ map equipSpeed $ IM.elems $ _crInv $ _creatures w IM.! 0
wasdWithAiming :: World -> Float -> Float -> Int -> Creature -> Creature
+2
View File
@@ -88,6 +88,8 @@ data World = World
, _seenLocations :: IM.IntMap (World -> Point2,String)
, _selLocation :: Int
, _keyConfig :: KeyConfigSDL
, _varMovementSpeedModifier :: Float
, _varMovementStrafeSpeedModifier :: Float
}
data Corpse = Corpse
+2
View File
@@ -232,6 +232,8 @@ defaultWorld = World
]
, _selLocation = 0
, _keyConfig = defaultKeyConfigSDL
, _varMovementSpeedModifier = 3
, _varMovementStrafeSpeedModifier = 3
}
youLight =
-- LS {_lsEff = \w _ p -> (logistic 1 1 1 (d p w * 0.01) )
+2
View File
@@ -34,6 +34,8 @@ handlePressedKey _ scancode w
-- Rotation seems to be duplicated here and in Camera.hs ? why
| scancode == rotateCameraPlusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w + 0.01}
| scancode == rotateCameraMinusKey (_keyConfig w) = Just $ w {_cameraRot = _cameraRot w - 0.01}
| scancode == ScancodeF7 = Just $ w {_varMovementSpeedModifier = _varMovementSpeedModifier w - 1}
| scancode == ScancodeF8 = Just $ w {_varMovementSpeedModifier = _varMovementSpeedModifier w + 1}
handlePressedKey _ _ w = Just w