Tweak pause camera movement
This commit is contained in:
@@ -18,5 +18,5 @@ autoCrit =
|
||||
, _crHP = 300
|
||||
, _crMvType = defaultAimMvType
|
||||
}
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ AutoAI
|
||||
|
||||
@@ -38,7 +38,13 @@ chaseCrit =
|
||||
, _crInv = IM.fromList [(0, medkit 200)]
|
||||
, _crMeleeCooldown = 0
|
||||
, _crFaction = ColorFaction green
|
||||
, _crVocalization =
|
||||
, _crVocalization = chaseCritVocalization
|
||||
, _crMvType = defaultChaseMvType
|
||||
}
|
||||
& crType . humanoidAI .~ ChaseAI
|
||||
|
||||
chaseCritVocalization :: Vocalization
|
||||
chaseCritVocalization =
|
||||
Vocalization
|
||||
seagullChatterS
|
||||
[ seagullBarkS
|
||||
@@ -52,6 +58,3 @@ chaseCrit =
|
||||
]
|
||||
50
|
||||
0
|
||||
, _crMvType = defaultChaseMvType
|
||||
}
|
||||
-- & crType . humanoidAI .~ ChaseAI
|
||||
|
||||
@@ -17,5 +17,5 @@ launcherCrit =
|
||||
, _crState = defaultState
|
||||
, _crHP = 300
|
||||
}
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
& crType . humanoidAI .~ LauncherAI
|
||||
|
||||
@@ -18,4 +18,4 @@ ltAutoCrit =
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ LtAutoAI
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -18,4 +18,4 @@ pistolCrit =
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ PistolAI
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -18,4 +18,4 @@ spreadGunCrit =
|
||||
, _crHP = 500
|
||||
}
|
||||
& crType . humanoidAI .~ SpreadGunAI
|
||||
& crType . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ lightx4 red
|
||||
|
||||
@@ -53,13 +53,12 @@ foldCr xs cr w = foldl' f w xs
|
||||
stateUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
||||
stateUpdate f =
|
||||
foldCr
|
||||
[ doDamage -- these three
|
||||
, checkDeath -- must be in
|
||||
, clearDamage -- this order 24/7/22
|
||||
, internalUpdate
|
||||
[ doDamage -- these two
|
||||
, checkDeath -- must be in this order 24/7/22
|
||||
, internalHammerUpdate
|
||||
, f
|
||||
, movementSideEff
|
||||
, upInv -- upInv must be called before invSideEff 22.05.23
|
||||
, updateInv -- upInv must be called before invSideEff 22.05.23
|
||||
, invSideEff
|
||||
, equipmentEffects
|
||||
, heldAimEffects
|
||||
@@ -76,6 +75,7 @@ heldAimEffects cr = fromMaybe id $ do
|
||||
checkDeath :: Creature -> World -> World
|
||||
checkDeath cr w
|
||||
| _crHP cr > 0 = w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
|
||||
| otherwise =
|
||||
w
|
||||
-- & creatures . at (_crID cr) .~ Nothing
|
||||
@@ -139,8 +139,8 @@ bloodPuddleAt p w =
|
||||
where
|
||||
(q, g) = randInCirc 10 & runState $ _randGen w
|
||||
|
||||
internalUpdate :: Creature -> World -> World
|
||||
internalUpdate cr =
|
||||
internalHammerUpdate :: Creature -> World -> World
|
||||
internalHammerUpdate cr =
|
||||
cWorld . lWorld . creatures . ix (_crID cr)
|
||||
%~ ( (crHammerPosition %~ moveHammerUp)
|
||||
. stepReloading
|
||||
@@ -156,11 +156,6 @@ dropByState cr w = foldr (dropItem cr) w $ case cr ^. crState . csDropsOnDeath o
|
||||
DropSpecific xs -> xs
|
||||
DropAmount n -> take n $ evalState (shuffle $ IM.keys $ _crInv cr) (_randGen w)
|
||||
|
||||
clearDamage :: Creature -> World -> World
|
||||
clearDamage cr w =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
|
||||
|
||||
doDamage :: Creature -> World -> World
|
||||
doDamage cr w =
|
||||
w
|
||||
@@ -225,8 +220,8 @@ useEquipment cr i = useE (_eeUse (_equipEffect $ _itUse itm)) itm cr
|
||||
itm = _crInv cr IM.! i
|
||||
|
||||
-- a map updating all inventory items
|
||||
upInv :: Creature -> World -> World
|
||||
upInv cr = cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ IM.mapWithKey (itemUpdate cr)
|
||||
updateInv :: Creature -> World -> World
|
||||
updateInv cr = cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ IM.mapWithKey (itemUpdate cr)
|
||||
|
||||
-- a loop going over equipped items
|
||||
equipmentEffects :: Creature -> World -> World
|
||||
|
||||
@@ -17,7 +17,7 @@ swarmCrit =
|
||||
, _crFaction = ColorFaction yellow
|
||||
, _crMeleeCooldown = 0
|
||||
}
|
||||
& crType . skinUpper .~ light4 yellow
|
||||
& crType . skinUpper .~ lightx4 yellow
|
||||
& crType . humanoidAI .~ SwarmAI
|
||||
|
||||
--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
|
||||
|
||||
@@ -45,6 +45,11 @@ crWeaponReady cr = fromMaybe False $ do
|
||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||
|
||||
--crCanSeeCrid :: Int -> (World, Creature) -> Bool
|
||||
--crCanSeeCrid tcid (w, cr) = fromMaybe False $ do
|
||||
-- tcr <- w ^? cWorld . lWorld . creatures . ix tcid
|
||||
-- return $ hasLOS (_crPos cr) (_crPos tcr) w
|
||||
|
||||
crIsAiming :: Creature -> Bool
|
||||
crIsAiming cr = _posture (_crStance cr) == Aiming
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ module Dodge.Creature.YourControl (
|
||||
yourControl,
|
||||
) where
|
||||
|
||||
import Dodge.WASD
|
||||
import Dodge.Base.You
|
||||
import Dodge.Creature.Impulse.UseItem
|
||||
import Data.Foldable
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Coordinate
|
||||
@@ -74,7 +74,7 @@ wasdWithAiming w speed cr
|
||||
| movDir == V2 0 0 = id
|
||||
| otherwise = crMvForward speed
|
||||
theTurn cr' = creatureTurnTowardDir (_crMvAim cr') 0.2 cr'
|
||||
movDir = wasdDir w
|
||||
movDir = wasdDir (w ^. input)
|
||||
dir = fmap ((w ^. wCam . camRot) +) (safeArgV movDir)
|
||||
movAbs = rotateV (w ^. wCam . camRot) $ normalizeV movDir
|
||||
isAiming = _posture (_crStance cr) == Aiming
|
||||
@@ -92,16 +92,6 @@ aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
|
||||
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix itRef . itUse . heldAim . aimTurnSpeed
|
||||
|
||||
wasdM :: SDL.Scancode -> Point2
|
||||
wasdM scancode = case scancode of
|
||||
SDL.ScancodeW -> V2 0 1
|
||||
SDL.ScancodeS -> V2 0 (-1)
|
||||
SDL.ScancodeD -> V2 1 0
|
||||
SDL.ScancodeA -> V2 (-1) 0
|
||||
_ -> V2 0 0
|
||||
|
||||
wasdDir :: World -> Point2
|
||||
wasdDir = foldl' (flip $ (+.+) . wasdM) (V2 0 0) . M.keys . _pressedKeys . _input
|
||||
|
||||
-- | Set posture according to mouse presses.
|
||||
mouseActionsCr :: M.Map SDL.MouseButton Int -> Creature -> Creature
|
||||
@@ -128,5 +118,6 @@ pressedMBEffectsTopInventory pkeys w
|
||||
_ -> False
|
||||
isDown but = but `M.member` pkeys
|
||||
theinput = w ^. input
|
||||
rotation = fromMaybe 0
|
||||
$ angleBetween (theinput ^. mousePos) <$> (theinput ^. heldPos . at SDL.ButtonMiddle)
|
||||
rotation = maybe 0
|
||||
(angleBetween (theinput ^. mousePos))
|
||||
(theinput ^. heldPos . at SDL.ButtonMiddle)
|
||||
|
||||
Reference in New Issue
Block a user