Files
loop/src/Dodge/SpawnAt.hs
T

31 lines
1.2 KiB
Haskell

module Dodge.SpawnAt (respawn) where
import qualified Data.Set as S
import LensHelp
import Dodge.SoundLogic
import Linear
import Dodge.Creature
import Geometry.Data
import Dodge.Data.World
respawn :: World -> World
respawn w = w & uncurry spawnAt (w ^. cWorld . lWorld . respawnPos)
spawnAt :: Point2 -> Float -> World -> World
spawnAt p d w = w
& wCam . camZoom .~ 0.000000001
& wCam . camDefaultZoom .~ 0.000000001
& wSoundFilter .~ FilterBySoundOrigin (S.singleton SpawnSound)
-- & cWorld . lWorld . creatures . at 0 %~ (fmap f . (<|> Just startCr))
& cWorld . lWorld . creatures . at 0 ?~ f startCr
& cWorld . lWorld . delayedEvents <>~
[ (0,SoundStart SpawnSound 0 reverseCymbal1S Nothing)
, (10,WdWdSetSoundFilter NoSoundFilter)
]
-- & cWorld . lWorld . worldEvents <>~
---- SoundStart BackgroundSound p foamSprayFadeOutS Nothing :
-- [MakeStartCloudAt (V3 x y 20 & _xy +~ p) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
where
--f = set (crPos . _xy) p . set crDir d . set crMvDir d . set crMvAim d . set (crPos . _z) 0 . set crZVel 0
f = set (crPos . _xy) p . set crDir d . set crMvDir d . set (crPos . _z) 0 . set crZVel 0