Files
loop/src/Dodge/WorldEvent/SpawnParticle.hs
T
2025-06-09 08:40:47 +01:00

53 lines
1.2 KiB
Haskell

-- | Creation of particles in the world.
module Dodge.WorldEvent.SpawnParticle (
makeGasCloud,
concBall,
) where
import Dodge.Data.World
import Geometry
import LensHelp
import Picture
import RandomHelp
concBall :: Point2 -> Shockwave
concBall p =
Shockwave
{ _swDirection = OutwardShockwave
, _swInvulnerableCrs = []
, _swColor = white
, _swPos = p
, _swRad = 15
, _swDam = 4
, _swPush = 1
, _swMaxTime = 10
, _swTimer = 10
}
-- | At writing the radius is half the size of the effect area
makeGasCloud ::
-- | Position
Point2 ->
-- | Velocity
Point2 ->
World ->
World
makeGasCloud pos vel w =
w
& cWorld . lWorld . clouds .:~ theCloud
& randGen .~ g
where
theCloud =
Cloud
{ _clPos = addZ 20 pos
, _clVel = addZ 0 vel
, _clPict = CloudColor 3 50 (withAlpha 0.05 col)
, _clRad = 10
, _clAlt = 25
, _clTimer = 400
, _clType = GasCloud
}
(col, g) = runState (takeOne [green, yellow]) $ _randGen w
{- Attach poison cloud damage to creatures near cloud. -}