Move radar blips into own grouping, work on data-ifying particles

This commit is contained in:
2022-07-10 12:38:32 +01:00
parent ce5b596d4f
commit 23022d85a1
10 changed files with 290 additions and 32 deletions
+12 -2
View File
@@ -25,9 +25,16 @@ import LensHelp
import System.Random
muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w = w & instantParticles .:~ Particle
muzFlareAt col tranv dir w = w & instantParticles .:~ PtMuzFlare
{ _ptDraw = const $ setLayer BloomNoZWrite . translate3 tranv $ theShape
, _ptUpdate = ptSimpleTime 2
, _ptPoly =
[ V2 0 0
, V2 a (-b)
, V2 c d
]
, _ptColor = col
, _ptTran3 = tranv
}
where
theShape = rotate dir . color col $ polygon
@@ -38,10 +45,13 @@ muzFlareAt col tranv dir w = w & instantParticles .:~ Particle
(a:b:c:d:_) = randomRs (2,20) (_randGen w)
flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv = instantParticles .:~ Particle
flareCircleAt col alphax tranv = instantParticles .:~ PtCircFlare
{ _ptDraw = const . setLayer BloomNoZWrite . translate3 tranv
$ circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
, _ptUpdate = ptSimpleTime 1
, _ptColor = col
, _ptAlpha = alphax
, _ptTran3 = tranv
}
explosionFlashAt :: Point2 -> World -> World
+5 -3
View File
@@ -129,7 +129,7 @@ concBall p = return Shockwave
aStaticBall :: Point2 -> State g Particle
aStaticBall p = return PtZ
aStaticBall p = return PtStaticBall
{ _ptDraw = drawStaticBall
, _ptUpdate = moveStaticBall
, _ptVel = 0
@@ -153,7 +153,7 @@ makeFlamelet
-> World
makeFlamelet (V2 x y) z vel maycid size time w = w
& randGen .~ g
& instantParticles .:~ PtZ
& instantParticles .:~ PtIncBall
{ _ptDraw = drawFlameletZ rot
, _ptUpdate = moveFlamelet
, _ptVel = vel
@@ -164,6 +164,7 @@ makeFlamelet (V2 x y) z vel maycid size time w = w
, _ptTimer = time
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 20
, _ptZ = z
, _ptRot = rot
}
where
(rot ,g) = randomR (0,3) $ _randGen w
@@ -255,7 +256,7 @@ cloudPoisonDamage c w = w & dodamagesto (S.filter f $ crsNearPoint clpos w)
incBall :: RandomGen g => Point2 -> State g Particle
incBall p = do
rot <- state $ randomR (0,3)
return PtZ
return PtIncBall
{ _ptDraw = drawFlameletZ rot
, _ptUpdate = moveFlamelet
, _ptVel = 0
@@ -266,6 +267,7 @@ incBall p = do
, _ptTimer = 20
, _ptHitEff = expireAndDamage $ simpleDam FLAMING 20
, _ptZ = 20
, _ptRot = rot
}
drawFlameletZ
:: Float -- ^ Rotation