Rotate camera on chasm edges
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module Dodge.Creature.Update (updateCreature) where
|
||||
|
||||
import Dodge.Update.Camera.Rotate
|
||||
import SDL (MouseButton (..))
|
||||
import Dodge.Creature.Vocalization
|
||||
import RandomHelp
|
||||
import Data.Maybe
|
||||
@@ -128,6 +130,7 @@ chasmTest cr w
|
||||
| Just (x, y) <- List.find g (w ^. cWorld . cliffs) = w
|
||||
& soundContinue (CrChasm (_crID cr)) (cr ^. crPos . _xy) debrisS (Just 100)
|
||||
& tocr . crPos . _xy -~ normalizeV (vNormal (x - y))
|
||||
& chasmRotate cr (x - y)
|
||||
| any f (w ^. cWorld . chasms) = w & tocr . crZVel -~ 0.5
|
||||
| otherwise = w
|
||||
where
|
||||
@@ -135,6 +138,13 @@ chasmTest cr w
|
||||
g = uncurry $ circOnSeg (cr ^. crPos . _xy) (crRad $ cr ^. crType)
|
||||
f = circInPolygon (cr ^. crPos . _xy) (crRad $ cr ^. crType)
|
||||
|
||||
chasmRotate :: Creature -> Point2 -> World -> World
|
||||
chasmRotate cr v w
|
||||
| t = rotateTo8 (argV v) w
|
||||
| otherwise = w
|
||||
where
|
||||
t = cr ^. crID == 0 && isNothing (w ^? input . mouseButtons . ix SDL.ButtonRight)
|
||||
|
||||
updatePulse :: Pulse -> Pulse
|
||||
updatePulse p
|
||||
| p ^. pulseProgress >= p ^. pulseRate = p & pulseProgress .~ 0
|
||||
|
||||
Reference in New Issue
Block a user