Add machine sounds

This commit is contained in:
2022-03-15 10:12:41 +00:00
parent 8fb42bca2d
commit a36139aa7a
6 changed files with 97 additions and 62 deletions
+12
View File
@@ -2,6 +2,10 @@ module Dodge.Machine where
import Dodge.Data
import Dodge.Wall.Delete
import LensHelp
import Sound.Data
import Dodge.SoundLogic
import Geometry
import Dodge.Base
import qualified Data.IntMap.Strict as IM
@@ -15,3 +19,11 @@ machineUpdateDeathEff f mc
where
dams = sum $ map _dmAmount $ _mcDamage mc
mcid = _mcID mc
machineAddSound :: SoundID -> (Machine -> World -> World) -> Machine -> World -> World
machineAddSound sid f mc w
| dist (_crPos $ you w) (_mcPos mc) < 100
= soundContinue (MachineSound mid) (_mcPos mc) sid (Just 2) $ f mc w
| otherwise = f mc w
where
mid = _mcID mc