Reloading slows movement
This commit is contained in:
@@ -12,6 +12,7 @@ import qualified SDL
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Data.Monoid
|
||||
import Data.Maybe
|
||||
{- | The AI equivalent for your control. -}
|
||||
yourControl
|
||||
:: Creature
|
||||
@@ -62,8 +63,10 @@ wasdDir w = foldr ((+.+) . wasdM) (V2 0 0) $ _keys w
|
||||
|
||||
{- | Set posture according to mouse presses. -}
|
||||
mouseActionsCr :: S.Set SDL.MouseButton -> Creature -> Creature
|
||||
mouseActionsCr pkeys
|
||||
| rbPressed = crStance . posture .~ Aiming
|
||||
| otherwise = crStance . posture .~ AtEase
|
||||
mouseActionsCr pkeys cr
|
||||
| reloading = cr & crStance . posture .~ Reloading
|
||||
| rbPressed = cr & crStance . posture .~ Aiming
|
||||
| otherwise = cr & crStance . posture .~ AtEase
|
||||
where
|
||||
reloading = isJust $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . reloadState . _Just'
|
||||
rbPressed = SDL.ButtonRight `S.member` pkeys
|
||||
|
||||
Reference in New Issue
Block a user