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 (CrWeaponO (cr ^. crID)) 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 (CrWeaponO (cr ^. crID)) 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