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
+27
View File
@@ -0,0 +1,27 @@
module Dodge.RadarSweep.Draw where
import Dodge.Data.Object
import Dodge.Data.RadarSweep
import Geometry
import Picture
drawRadarSweep :: RadarSweep -> Picture
drawRadarSweep pt = setLayer DebugLayer $ pictures sweepPics
where
col = rsObjectColor $ _rsObject pt
p = _rsPos pt
r = _rsRad 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 = _rsTimer pt
rsObjectColor :: Object -> Color
rsObjectColor ob = case ob of
ObWall -> red
ObCreature -> green
ObItem -> blue
_ -> yellow