Files
loop/src/Dodge/Gas.hs
T
2025-10-12 20:40:40 +01:00

27 lines
863 B
Haskell

module Dodge.Gas where
import Linear
import Control.Lens
import Dodge.Data.World
import Dodge.Flame
import Dodge.WorldEvent
import Geometry
createGas :: GasCreate -> Float -> Point2 -> Float -> Creature -> World -> World
createGas gc = case gc of
CreatePoisonGas -> aGasCloud
CreateFlame -> aFlame
aGasCloud :: Float -> Point2 -> Float -> Creature -> World -> World
aGasCloud pressure pos dir cr =
makeGasCloud pos $
(cr ^. crPos . _xy - cr ^. crOldPos . _xy) + pressure *^ unitVectorAtAngle dir
aFlame :: Float -> Point2 -> Float -> Creature -> World -> World
aFlame pressure pos dir cr = makeFlame pos vel
where
--w & instantParticles .:~ aFlameParticle t pos vel Nothing -- (Just $ _crID cr)
-- (t,_) = randomR (99,101) (_randGen w)
vel = (cr ^. crPos . _xy - cr ^. crOldPos . _xy) + pressure *^ unitVectorAtAngle dir