Simplify clouds

This commit is contained in:
2025-06-24 09:42:51 +01:00
parent 366b998989
commit b1041d1eb0
12 changed files with 110 additions and 96 deletions
+21 -21
View File
@@ -1,8 +1,8 @@
module Dodge.WorldEvent.Cloud (
makeFlamerSmokeAt,
smokeCloudAt,
makeThinSmokeAt,
makeThickSmokeAt,
-- makeThinSmokeAt,
-- makeThickSmokeAt,
shellTrailCloud,
spawnSmokeAtCursor,
makeStartCloudAt,
@@ -13,12 +13,12 @@ import Dodge.Data.World
import Geometry.Data
import LensHelp
import Picture
import System.Random
--import System.Random
makeCloudAt ::
CloudDraw ->
-- | radius
Float ->
-- CloudDraw ->
-- -- | radius
-- Float ->
-- | timer
Int ->
-- | resting altitude
@@ -26,13 +26,13 @@ makeCloudAt ::
Point3 -> -- start position
World ->
World
makeCloudAt drawFunc rad t alt p =
makeCloudAt t alt p =
cWorld . lWorld . clouds
.:~ Cloud
{ _clPos = p
, _clVel = V3 0 0 0
, _clPict = drawFunc
, _clRad = rad
-- , _clPict = drawFunc
-- , _clRad = rad
, _clAlt = alt
, _clTimer = t
, _clType = SmokeCloud
@@ -41,7 +41,7 @@ makeCloudAt drawFunc rad t alt p =
smokeCloudAt ::
Color ->
-- | radius
Float ->
-- Float ->
-- | timer
Int ->
-- | resting altitude
@@ -49,26 +49,26 @@ smokeCloudAt ::
Point3 -> -- start position
World ->
World
smokeCloudAt col = makeCloudAt (CloudColor (4 / 3) 800 col)
smokeCloudAt col = makeCloudAt
makeThickSmokeAt :: Point3 -> World -> World
makeThickSmokeAt = makeCloudAt (CloudColor 4 50 black) 3 50 30
makeThinSmokeAt :: Point3 -> World -> World
makeThinSmokeAt = makeCloudAt (CloudColor 4 400 (withAlpha 0.05 black)) 5 400 50
--makeThickSmokeAt :: Point3 -> World -> World
--makeThickSmokeAt = makeCloudAt 50 30
--
--makeThinSmokeAt :: Point3 -> World -> World
--makeThinSmokeAt = makeCloudAt 400 50
makeStartCloudAt :: Point3 -> World -> World
--makeStartCloudAt = makeCloudAt (CloudColor 2 800 white) 10 400 5
--makeStartCloudAt = makeCloudAt (CloudColor 2 200 white) 10 400 50
makeStartCloudAt = makeCloudAt (CloudColor 2 200 white) 10 400 50
makeStartCloudAt = makeCloudAt 400 50
shellTrailCloud :: Int -> Float -> Point3 -> World -> World
shellTrailCloud age fadet = makeCloudAt (CloudColor (3 / 2) fadet (greyN 0.5)) 15 age 30
shellTrailCloud age fadet = makeCloudAt age 30
makeFlamerSmokeAt :: Point3 -> World -> World
makeFlamerSmokeAt p w = makeCloudAt (CloudColor 4 300 (greyN x)) 6 200 40 p w
where
x = fst $ randomR (0.5, 0.8) (_randGen w)
makeFlamerSmokeAt p w = makeCloudAt 200 40 p w
-- where
-- x = fst $ randomR (0.5, 0.8) (_randGen w)
spawnSmokeAtCursor :: World -> World
spawnSmokeAtCursor w = shellTrailCloud 400 100 (V3 x y 20) w
+8 -9
View File
@@ -1,13 +1,11 @@
-- | Creation of particles in the world.
module Dodge.WorldEvent.SpawnParticle (
makeGasCloud,
) where
module Dodge.WorldEvent.SpawnParticle (makeGasCloud) where
import Dodge.Data.World
import Geometry
import LensHelp
import Picture
import RandomHelp
--import Picture
--import RandomHelp
-- | At writing the radius is half the size of the effect area
makeGasCloud ::
@@ -20,18 +18,19 @@ makeGasCloud ::
makeGasCloud pos vel w =
w
& cWorld . lWorld . clouds .:~ theCloud
& randGen .~ g
where
-- & randGen .~ g
theCloud =
Cloud
{ _clPos = addZ 20 pos
, _clVel = addZ 0 vel
, _clPict = CloudColor 3 50 (withAlpha 0.5 col)
, _clRad = 10
-- , _clPict = CloudColor 50 -- (withAlpha 0.5 col)
, _clAlt = 25
, _clTimer = 400
, _clType = GasCloud
}
(col, g) = runState (takeOne [green, yellow]) $ _randGen w
-- (col, g) = runState (takeOne [green, yellow]) $ _randGen w
{- Attach poison cloud damage to creatures near cloud. -}