module Dodge.SpawnAt (respawn) where --import Dodge.SoundLogic.ExternallyGeneratedSounds import Dodge.Creature import Geometry.Data import Dodge.Data.World import Control.Lens --import Control.Applicative --import Linear.V3 respawn :: World -> World respawn w = w & uncurry spawnAt (w ^. cWorld . lWorld . respawnPos) spawnAt :: Point2 -> Float -> World -> World spawnAt p d w = w & wCam . camZoom .~ 1000 -- & cWorld . lWorld . creatures . at 0 %~ (fmap f . (<|> Just startCr)) & cWorld . lWorld . creatures . at 0 ?~ f startCr -- & 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 p . set crDir d . set crMvDir d . set crMvAim d . set crZ 0 . set crZVel 0