Files
loop/src/Dodge/Projectile/Draw.hs
T
2024-09-27 21:55:17 +01:00

46 lines
1.2 KiB
Haskell

module Dodge.Projectile.Draw
( drawProjectile
) where
import Dodge.Data.Item.Use.Consumption.Ammo
import Dodge.Data.Projectile
import Geometry
import Picture
import Shape
import ShapePicture
drawProjectile :: Projectile -> SPic
drawProjectile prj = case _prjDraw prj of
DrawShell -> drawShell prj
DrawRemoteShell -> drawRemoteShell prj
DrawDrone -> drawShell prj
DrawBlankProjectile -> mempty
drawShell :: Projectile -> SPic
drawShell pj =
noPic
. translateSHz 18
. uncurryV translateSHxy (_prjPos pj)
$ rotateSH (argV $ _prjAcc pj) shellShape
shellShape :: Shape
shellShape = colorSH black $ upperPrismPoly Small Typical 4 $ map toV2 [(-6, 4), (-6, -4), (6, -4), (8, 0), (6, 4)]
drawRemoteShell :: Projectile -> SPic
drawRemoteShell pj
| rem (t + 200) 20 < 9 =
doposition $ noPic shellShape
| otherwise = doposition $ remoteShellShape col
where
col
| t > (-99) = green
| otherwise = red
t = _prjTimer pj
doposition = translateSPz 18 . uncurryV translateSPxy (_prjPos pj) . rotateSP (_prjDir pj)
remoteShellShape :: Color -> SPic
remoteShellShape col =
( shellShape
, setLayer BloomNoZWrite . setDepth 4.5 . color col $ circleSolid 3
)