29 lines
804 B
Haskell
29 lines
804 B
Haskell
{- |
|
|
Particles and pictures that decorate weapons, such as laser scopes etc.
|
|
-}
|
|
module Dodge.Item.Weapon.Decoration
|
|
( makeLaserScope
|
|
) where
|
|
import Dodge.Data
|
|
import Dodge.Picture.Layer
|
|
import Geometry.Data
|
|
import Picture
|
|
|
|
import Control.Lens
|
|
makeLaserScope
|
|
:: Point2 -- ^ Start point
|
|
-> Point2 -- ^ End point
|
|
-> Float -- ^ Fraction of red/green
|
|
-> Particle
|
|
makeLaserScope p ep relFrac = Particle
|
|
{_ptDraw = const $ setLayer 1 $ onLayer PtLayer $ pictures
|
|
[lineAlphaThick 0.5 0.5
|
|
,lineAlphaThick 0.2 1.5
|
|
,lineAlphaThick 0.1 2
|
|
]
|
|
,_ptUpdate = \w pt -> (w, Just $ pt & ptUpdate .~ \w' _ -> (w',Nothing))
|
|
}
|
|
where
|
|
lineAlphaThick a w =
|
|
color (withAlpha a $ mixColors relFrac (1-relFrac) red green) $ thickLine w [p,ep]
|