33 lines
825 B
Haskell
33 lines
825 B
Haskell
module Dodge.Flare where
|
|
|
|
import Dodge.Data.Flare
|
|
import LensHelp
|
|
import Picture
|
|
|
|
updateFlare :: Flare -> Maybe Flare
|
|
updateFlare rb
|
|
| _flareTime rb <= 0 = Nothing
|
|
| otherwise = Just $ rb & flareTime -~ 1
|
|
|
|
drawFlare :: Flare -> Picture
|
|
drawFlare fl = case fl of
|
|
MuzFlare{} -> drawMuzFlare fl
|
|
CircFlare{} -> drawCircFlare fl
|
|
|
|
drawMuzFlare :: Flare -> Picture
|
|
drawMuzFlare pt = setLayer BloomNoZWrite . translate3 tranv $ theShape
|
|
where
|
|
tranv = _flareTran3 pt
|
|
col = _flareColor pt
|
|
poly = _flarePoly pt
|
|
theShape = color col $ polygon poly
|
|
|
|
drawCircFlare :: Flare -> Picture
|
|
drawCircFlare pt =
|
|
setLayer BloomNoZWrite . translate3 tranv $
|
|
circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
|
|
where
|
|
col = _flareColor pt
|
|
tranv = _flareTran3 pt
|
|
alphax = _flareAlpha pt
|