Start projectile refactor

This commit is contained in:
2022-07-20 01:44:16 +01:00
parent 6e901d3086
commit 9daf872878
6 changed files with 56 additions and 38 deletions
+34
View File
@@ -0,0 +1,34 @@
module Dodge.Projectile.Draw where
import Dodge.Data
import Geometry
import Picture
import Shape
import ShapePicture
drawProjectile :: ProjectileDraw -> Prop -> SPic
drawProjectile pd = case pd of
DrawShell -> drawShell
DrawRemoteShell -> drawRemoteShell
drawShell :: Prop -> SPic
drawShell pj = noPic
. translateSHz 18
. uncurryV translateSHf (_prPos pj)
$ rotateSH (argV $ _pjAcc pj) shellShape
shellShape :: Shape
shellShape = colorSH black $ upperPrismPoly 4 $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
drawRemoteShell :: Prop -> SPic
drawRemoteShell pj
| rem (t+200) 20 < 9
= doposition $ noPic shellShape
| otherwise = doposition $ remoteShellShape col
where
col | t > (-99) = green
| otherwise = red
t = _pjTimer pj
doposition = translateSPz 18 . uncurryV translateSPf (_prPos pj) . rotateSP (_pjDir pj)
remoteShellShape :: Color -> SPic
remoteShellShape col = (shellShape
, setLayer BloomNoZWrite . setDepth 4.5 . color col $ circleSolid 3
)