Allow bullets to spawn bullets
This commit is contained in:
@@ -21,7 +21,6 @@ import Data.Bifunctor
|
|||||||
|
|
||||||
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
|
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
|
||||||
updateBullet w bu
|
updateBullet w bu
|
||||||
-- | magV (_buVel bu) < 1 || _buTimer bu <= 0 = (endspawn w, Nothing)
|
|
||||||
| magV (_buVel bu) < 1 = (endspawn w, Nothing)
|
| magV (_buVel bu) < 1 = (endspawn w, Nothing)
|
||||||
| otherwise =
|
| otherwise =
|
||||||
second (fmap updateBulVel)
|
second (fmap updateBulVel)
|
||||||
@@ -208,7 +207,6 @@ moveBullet pt =
|
|||||||
pt
|
pt
|
||||||
& buPos %~ (+.+ _buVel pt)
|
& buPos %~ (+.+ _buVel pt)
|
||||||
& buOldPos .~ _buPos pt
|
& buOldPos .~ _buPos pt
|
||||||
-- & buTimer -~ 1
|
|
||||||
|
|
||||||
destroyAt :: Point2 -> Bullet -> Maybe Bullet
|
destroyAt :: Point2 -> Bullet -> Maybe Bullet
|
||||||
destroyAt hitp pt =
|
destroyAt hitp pt =
|
||||||
|
|||||||
+5
-4
@@ -541,12 +541,13 @@ updateDistortions = updateObjMapMaybe distortions updateDistortion
|
|||||||
updateRadarBlips :: World -> World
|
updateRadarBlips :: World -> World
|
||||||
updateRadarBlips = updateObjMapMaybe radarBlips updateRadarBlip
|
updateRadarBlips = updateObjMapMaybe radarBlips updateRadarBlip
|
||||||
|
|
||||||
{- Apply internal particle updates, delete 'Nothing's. -}
|
-- if changing, make sure that bullets can still spawn new bullets
|
||||||
updateBullets :: World -> World
|
updateBullets :: World -> World
|
||||||
--updateBullets w = updateInstantBullets $ set (cWorld . lWorld . bullets) (catMaybes ps) w'
|
updateBullets w = w'
|
||||||
updateBullets w = set (cWorld . lWorld . bullets) (catMaybes ps) w'
|
& cWorld . lWorld . bullets %~ (++ catMaybes ps)
|
||||||
where
|
where
|
||||||
(w', ps) = mapAccumR updateBullet w $ w ^. cWorld . lWorld . bullets
|
(w', ps) = mapAccumR updateBullet (w & cWorld . lWorld . bullets .~ [])
|
||||||
|
$ w ^. cWorld . lWorld . bullets
|
||||||
|
|
||||||
updateTeslaArcs :: World -> World
|
updateTeslaArcs :: World -> World
|
||||||
updateTeslaArcs = updateObjCatMaybes teslaArcs updateTeslaArc
|
updateTeslaArcs = updateObjCatMaybes teslaArcs updateTeslaArc
|
||||||
|
|||||||
Reference in New Issue
Block a user