Create datatypes for radar sweeps

This commit is contained in:
2022-07-19 20:38:56 +01:00
parent b4c0074d43
commit 29e25f61d3
14 changed files with 139 additions and 123 deletions
-16
View File
@@ -11,8 +11,6 @@ drawParticle pt = case pt of
PtTargetLaser {} -> drawTargetLaser pt
LaserParticle {} -> drawLaser pt
ShockLine {} -> drawSonicWave pt
RadarCircleParticle {} -> drawPulse pt
drawShockwave :: Particle -> Picture
drawShockwave pt = setDepth 20
@@ -72,17 +70,3 @@ drawSonicWave pt = foldMap (color (_ptColor pt) . setLayer BloomNoZWrite . setDe
. map fst)
$ _ptPointDirs pt
drawPulse :: Particle -> Picture
drawPulse pt = setLayer DebugLayer $ pictures sweepPics
where
col = _ptColor pt
p = _ptPos pt
r = _ptRad pt
sweepPics = [colHelper 0.1 $ uncurryV translate p $ thickCircle r 15
,colHelper 0.06 $ uncurryV translate p $ thickCircle (r-5) 5
,colHelper 0.03 $ uncurryV translate p $ thickCircle (r-10) 5
]
colHelper y = color (withAlpha (y * globalAlpha) col)
globalAlpha | x > 10 = 1
| otherwise = fromIntegral x / 10
x = _ptTimer pt