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
+4 -1
View File
@@ -14,14 +14,17 @@ makeLaserScope
-> Point2 -- ^ End point
-> Float -- ^ Fraction of red/green
-> Particle
makeLaserScope p ep relFrac = Particle
makeLaserScope p ep relFrac = PtTargetLaser
{_ptDraw = const $ setLayer BloomLayer $ setDepth 20 $ 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))
, _ptPoints = [p,ep]
, _ptColor = col
}
where
lineAlphaThick a w =
color (withAlpha a $ mixColors relFrac (1-relFrac) red green) $ thickLine w [p,ep]
col = mixColors relFrac (1-relFrac) red green
+3 -1
View File
@@ -198,12 +198,14 @@ targetLaserUpdate _ cr w t
(mp, ps) = reflectLaserAlong 0.2 sp ep w
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
addLaserPic = instantParticles .:~ Particle
addLaserPic = instantParticles .:~ PtTargetLaser
{ _ptDraw = const $ setLayer BloomNoZWrite $ pictures
[ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 5 (sp:ps)
, setDepth 19.5 . color (brightX 5 1 col) $ thickLine 1 (sp:ps)
]
, _ptUpdate = ptSimpleTime 1
, _ptPoints = (sp:ps)
, _ptColor = col
}
--wpammo = _itConsumption it
-- reloadFrac
+1
View File
@@ -36,6 +36,7 @@ aRadarPulse blipsF bf col cr = instantParticles .:~ RadarCircleParticle
, _ptTimer = 100
, _ptRad = 0
, _ptPos = _crPos cr
, _ptColor = col
}
drawPulse :: Color -> Particle -> Picture
drawPulse col pt = setLayer DebugLayer $ pictures sweepPics