This commit is contained in:
2022-07-10 12:51:20 +01:00
parent 23022d85a1
commit 7a1dbbb3f9
13 changed files with 35 additions and 198 deletions
+1 -8
View File
@@ -15,16 +15,9 @@ makeLaserScope
-> Float -- ^ Fraction of red/green
-> 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))
{_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
+1 -5
View File
@@ -199,11 +199,7 @@ targetLaserUpdate _ cr w t
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
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
{ _ptUpdate = ptSimpleTime 1
, _ptPoints = (sp:ps)
, _ptColor = col
}
+1 -2
View File
@@ -66,8 +66,7 @@ aSonicWave it cr = instantParticles .:~ sonicWave pos dir cpos
sonicWave :: Point2 -> Float -> Point2 -> Particle
sonicWave pos dir cpos = ShockLine
{ _ptDraw = drawSonicWave
, _ptUpdate = mvSonicWave
{ _ptUpdate = mvSonicWave
, _ptPointDirs = [[makePointDir $ pos +.+ clockOrth,makePointDir $ pos -.- clockOrth]]
, _ptTimer = 1000
, _ptColor = white
+1 -15
View File
@@ -31,26 +31,12 @@ aRadarPulse :: (Point2 -> Float -> World -> [Point2])
-> Creature
-> World -> World
aRadarPulse blipsF bf col cr = instantParticles .:~ RadarCircleParticle
{ _ptDraw = drawPulse col
, _ptUpdate = mvRadar blipsF bf col (_crPos cr)
{ _ptUpdate = mvRadar blipsF bf col (_crPos cr)
, _ptTimer = 100
, _ptRad = 0
, _ptPos = _crPos cr
, _ptColor = col
}
drawPulse :: Color -> Particle -> Picture
drawPulse col pt = setLayer DebugLayer $ pictures sweepPics
where
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
{- | Radar blip at a point. -}
blipAt :: Float -> Point2 -> Color -> Int -> RadarBlip
blipAt r p col i = RadarBlip