Gunsmoke as clouds
This commit is contained in:
@@ -11,6 +11,33 @@ import Picture
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap as IM
|
||||
|
||||
makeCloudAt :: Float -> Int -> (Cloud -> Picture) -> Point2 -> World -> World
|
||||
makeCloudAt rad t drawFunc p w
|
||||
= w & clouds %~ IM.insert i theCloud
|
||||
where i = newKey $ _clouds w
|
||||
theCloud = Cloud { _clID = i
|
||||
, _clPos = p
|
||||
, _clVel = (0,0)
|
||||
, _clPict = drawFunc
|
||||
, _clRad = rad
|
||||
, _clTimer = t
|
||||
, _clEffect = const id
|
||||
}
|
||||
|
||||
fadeOutTime :: Color -> Float -> Cloud -> Picture
|
||||
fadeOutTime col fadet cl = setLayer 2
|
||||
. setDepth (-0.5)
|
||||
. color (withAlpha a col)
|
||||
$ circleSolid (4 * _clRad cl)
|
||||
where a = min 1 $ fromIntegral (_clTimer cl) / fadet
|
||||
|
||||
|
||||
makeThickSmokeAt :: Point2 -> World -> World
|
||||
makeThickSmokeAt = makeCloudAt 2 50 (fadeOutTime black 50)
|
||||
|
||||
makeThinSmokeAt :: Point2 -> World -> World
|
||||
makeThinSmokeAt = makeSmokeCloud
|
||||
|
||||
makeSmokeCloud :: Point2 -> World -> World
|
||||
makeSmokeCloud pos w = w & clouds %~ IM.insert i theCloud
|
||||
where i = newKey $ _clouds w
|
||||
|
||||
Reference in New Issue
Block a user