Replace particle pictures with draw functions

This commit is contained in:
2021-03-24 13:42:31 +01:00
parent 27fc9d19d2
commit 3cce959d00
8 changed files with 70 additions and 80 deletions
+3 -3
View File
@@ -55,7 +55,7 @@ glareLine t len wdth col alphay a b w = w & particles' %~ (maybeToList linePt ++
glareBetween :: Int -> Float -> Float -> Color -> Float -> Point2 -> Point2 -> World -> Maybe Particle'
glareBetween 0 _ _ _ _ _ _ _ = Nothing
glareBetween t len wdth col alphay a b w
= Just $ Particle' {_ptPict' = lowLightPic len wdth col alphay a b w
= Just $ Particle' {_ptDraw = const $ lowLightPic len wdth col alphay a b w
,_ptUpdate' = \ w' _ -> (w',glareBetween (t-1) len wdth col alphay a b w')
}
@@ -76,7 +76,7 @@ lowLightPic len wdth col alphay a b w
flashFlareAt :: Color -> Float -> Point2 -> Particle'
flashFlareAt col alphax (x,y) =
Particle'
{ _ptPict' = setLayer 2 . setDepth (-0.9) . translate x y
{ _ptDraw = const $ setLayer 2 . setDepth (-0.9) . translate x y
$ circleSolidCol (withAlpha 0 col) (withAlpha alphax col) 30
, _ptUpdate' = ptTimer' 1
}
@@ -102,7 +102,7 @@ muzzleFlashAt p = over particles' ((:) (muzzleFlashPt p))
muzzleFlashPt :: Point2 -> Particle'
muzzleFlashPt (x,y) =
Particle'
{ _ptPict' = setDepth 0
{ _ptDraw = const $ setDepth 0
. setLayer 2
. translate x y
$ circleSolidCol (withAlpha 0 white) (withAlpha 0.2 white) 20