module Dodge.Projectile.Draw ( drawProjectile, ) where import Control.Lens import Data.Strict.Tuple import Dodge.Data.Projectile import Geometry import Picture import Shape import ShapePicture drawProjectile :: Projectile -> SPic drawProjectile pj | RetiredProjectile <- pj ^. pjType = mempty | Just NoHoming <- pj ^? pjType . rkHoming = drawShell Nothing pj | Just _ <- pj ^? pjType . rkHoming = drawRemoteShell pj | otherwise = drawShell Nothing pj drawShell :: Maybe Color -> Projectile -> SPic drawShell mcol pj = -- translateSPz (_pjZ pj) -- . uncurryV translateSPxy (_pjPos pj) translateSP (pj ^. pjPos) $ rotateSP (_pjDir pj) $ shellShape :!: thelight where thelight = foldMap (\col -> setLayer BloomNoZWrite . setDepth 4.5 . color col $ circleSolid 3) mcol shellShape :: Shape shellShape = colorSH (greyN 0.5) $ 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 = drawShell Nothing pj | otherwise = drawShell (Just col) pj where col | t > (-99) = green | otherwise = red t = _pjTimer pj