Steps towards making clouds list based
This commit is contained in:
@@ -10,17 +10,16 @@ import qualified IntMapHelp as IM
|
||||
import Control.Lens
|
||||
|
||||
makeCloudAt :: Float -> Int -> (Cloud -> Picture) -> Point2 -> World -> World
|
||||
makeCloudAt rad t drawFunc p w = w & clouds %~ IM.insert i theCloud
|
||||
makeCloudAt rad t drawFunc p w = w & clouds %~ (theCloud :)
|
||||
where
|
||||
i = IM.newKey $ _clouds w
|
||||
theCloud = Cloud
|
||||
{ _clID = i
|
||||
, _clPos = p
|
||||
{ _clPos = p
|
||||
, _clVel = (0,0)
|
||||
, _clPict = drawFunc
|
||||
, _clRad = rad
|
||||
, _clTimer = t
|
||||
, _clEffect = const id
|
||||
, _clType = SmokeCloud
|
||||
--, _clEffect = const id
|
||||
}
|
||||
|
||||
drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture
|
||||
|
||||
@@ -264,19 +264,19 @@ makeGasCloud
|
||||
-> World
|
||||
-> World
|
||||
makeGasCloud pos vel w = w
|
||||
& clouds %~ IM.insert i theCloud
|
||||
& clouds %~ (theCloud :)
|
||||
& randGen .~ g
|
||||
where
|
||||
i = IM.newKey $ _clouds w
|
||||
theCloud = Cloud { _clID = i
|
||||
, _clPos = pos
|
||||
, _clVel = vel
|
||||
, _clPict = \_ -> onLayer CrLayer $ color (withAlpha 0.1 col)
|
||||
$ circleSolid 20
|
||||
, _clRad = 10
|
||||
, _clTimer = 400
|
||||
, _clEffect = cloudPoisonDamage
|
||||
}
|
||||
theCloud = Cloud
|
||||
{ _clPos = pos
|
||||
, _clVel = vel
|
||||
, _clPict = \_ -> onLayer CrLayer $ color (withAlpha 0.1 col)
|
||||
$ circleSolid 20
|
||||
, _clRad = 10
|
||||
, _clTimer = 400
|
||||
, _clType = GasCloud
|
||||
-- , _clEffect = cloudPoisonDamage
|
||||
}
|
||||
(col, g) = runState (takeOne [green,yellow]) $ _randGen w
|
||||
|
||||
{-
|
||||
|
||||
Reference in New Issue
Block a user