Add sound on spawn, allow for filtering of to play sounds

This commit is contained in:
2025-12-05 23:19:06 +00:00
parent a4f8369420
commit f9ce58b409
19 changed files with 752 additions and 695 deletions
+8 -4
View File
@@ -1,13 +1,12 @@
module Dodge.SpawnAt (respawn) where
import qualified Data.Set as S
import LensHelp
import Dodge.SoundLogic
import Linear
--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)
@@ -15,8 +14,13 @@ respawn w = w & uncurry spawnAt (w ^. cWorld . lWorld . respawnPos)
spawnAt :: Point2 -> Float -> World -> World
spawnAt p d w = w
& wCam . camZoom .~ 1000
& 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]]