Only update stride amount when actually moving
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.Creature.MoveType
|
||||
import Dodge.Render.List
|
||||
import Data.Foldable
|
||||
import qualified Data.Set as S
|
||||
@@ -251,6 +252,7 @@ functionalUpdate =
|
||||
. over uvWorld (cWorld . lWorld . lClock +~ 1)
|
||||
. over uvWorld updateDistortions
|
||||
. over uvWorld updateCreatureSoundPositions
|
||||
. over uvWorld updateCreatureStrides
|
||||
. colCrsWalls
|
||||
. over uvWorld simpleCrSprings
|
||||
. over uvWorld updateDoors
|
||||
@@ -307,6 +309,15 @@ functionalUpdate =
|
||||
. updateAimPos
|
||||
. over uvWorld updatePastWorlds -- it might be possible to do this without storing stuff such as the temporary lights/flares etc
|
||||
|
||||
updateCreatureStrides :: World -> World
|
||||
updateCreatureStrides w = foldl' updateCreatureStride w $ w ^. cWorld . lWorld . creatures
|
||||
|
||||
updateCreatureStride :: World -> Creature -> World
|
||||
updateCreatureStride w cr = w & cWorld . lWorld . creatures . ix (cr ^. crID) . crStance . carriage . strideAmount +~ d
|
||||
where
|
||||
s = fromMaybe 0 $ crMvType cr ^? mvSpeed
|
||||
d = min s . norm $ cr ^. crPos - cr ^. crOldPos
|
||||
|
||||
updateAimPos :: Universe -> Universe
|
||||
updateAimPos u =
|
||||
u & uvWorld . cWorld . lWorld . lAimPos
|
||||
|
||||
Reference in New Issue
Block a user