Refactor, try to limit dependencies
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module Dodge.Projectile.Create where
|
||||
|
||||
import Dodge.Data
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.Location
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module Dodge.Projectile.Draw where
|
||||
import Dodge.Data
|
||||
|
||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
import Dodge.Data.Projectile
|
||||
import Geometry
|
||||
import Picture
|
||||
import Shape
|
||||
@@ -11,25 +13,31 @@ drawProjectile prj = case _prjDraw prj of
|
||||
DrawRemoteShell -> drawRemoteShell prj
|
||||
DrawDrone -> drawShell prj
|
||||
DrawBlankProjectile -> mempty
|
||||
|
||||
drawShell :: Proj -> SPic
|
||||
drawShell pj = noPic
|
||||
. translateSHz 18
|
||||
. uncurryV translateSHf (_prjPos pj)
|
||||
$ rotateSH (argV $ _prjAcc pj) shellShape
|
||||
drawShell pj =
|
||||
noPic
|
||||
. translateSHz 18
|
||||
. uncurryV translateSHf (_prjPos pj)
|
||||
$ rotateSH (argV $ _prjAcc pj) shellShape
|
||||
|
||||
shellShape :: Shape
|
||||
shellShape = colorSH black $ upperPrismPoly 4 $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
shellShape = colorSH black $ upperPrismPoly 4 $ map toV2 [(-6, 4), (-6, -4), (6, -4), (8, 0), (6, 4)]
|
||||
|
||||
drawRemoteShell :: Proj -> SPic
|
||||
drawRemoteShell pj
|
||||
| rem (t+200) 20 < 9
|
||||
= doposition $ noPic shellShape
|
||||
| rem (t + 200) 20 < 9 =
|
||||
doposition $ noPic shellShape
|
||||
| otherwise = doposition $ remoteShellShape col
|
||||
where
|
||||
col | t > (-99) = green
|
||||
col
|
||||
| t > (-99) = green
|
||||
| otherwise = red
|
||||
t = _prjTimer pj
|
||||
doposition = translateSPz 18 . uncurryV translateSPf (_prjPos pj) . rotateSP (_prjDir pj)
|
||||
|
||||
remoteShellShape :: Color -> SPic
|
||||
remoteShellShape col = (shellShape
|
||||
remoteShellShape col =
|
||||
( shellShape
|
||||
, setLayer BloomNoZWrite . setDepth 4.5 . color col $ circleSolid 3
|
||||
)
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
|
||||
module Dodge.Projectile.Update where
|
||||
|
||||
--import qualified Data.Set as S
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Data
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.EnergyBall
|
||||
import Dodge.Item.Location
|
||||
@@ -71,7 +69,7 @@ explodeRemoteRocket' mitid thepj w =
|
||||
itid <- mitid
|
||||
itpos <- w ^? cWorld . itemLocations . ix itid
|
||||
return $
|
||||
(pointerToItemLocation itpos . itUse . rUse .~ HeldDoNothing)
|
||||
(pointerToItemLocation itpos . itUse . heldUse .~ HeldDoNothing)
|
||||
. (cWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid])
|
||||
pjid = _prjID thepj
|
||||
|
||||
@@ -127,7 +125,7 @@ retireRemoteProj'' itid pjid w =
|
||||
w
|
||||
& pointerToItemLocation (_itemLocations (_cWorld w) IM.! itid)
|
||||
%~ ( (itScope . scopePos .~ V2 0 0)
|
||||
. (itUse . rUse .~ HeldFireRemoteShell)
|
||||
. (itUse . heldUse .~ HeldFireRemoteShell)
|
||||
)
|
||||
& cWorld . props %~ IM.delete pjid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user