Identify broken wall collisions
This commit is contained in:
@@ -21,7 +21,7 @@ aGenBulAt
|
||||
-> Particle
|
||||
aGenBulAt maycid pos vel hiteff width = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = mvGenBullet
|
||||
, _ptUpdate = mvBullet
|
||||
, _btVel' = vel
|
||||
, _btColor' = V4 2 2 2 2
|
||||
, _btTrail' = [pos]
|
||||
@@ -40,7 +40,7 @@ aDelayedBulAt
|
||||
-> Particle
|
||||
aDelayedBulAt vfact maycid pos vel hiteff width = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = \w -> resetVel . mvGenBullet w
|
||||
, _ptUpdate = \w -> resetVel . mvBullet w
|
||||
, _btVel' = vfact *.* vel
|
||||
, _btColor' = V4 2 2 2 2
|
||||
, _btTrail' = [pos]
|
||||
@@ -50,7 +50,7 @@ aDelayedBulAt vfact maycid pos vel hiteff width = BulletPt
|
||||
, _btHitEffect' = hiteff
|
||||
}
|
||||
where
|
||||
resetVel = second $ fmap $ (ptUpdate .~ mvGenBullet) . (btVel' .~ vel)
|
||||
resetVel = second $ fmap $ (ptUpdate .~ mvBullet) . (btVel' .~ vel)
|
||||
|
||||
aCurveBulAt
|
||||
:: Maybe Int -- ^ Pass-through creature id
|
||||
@@ -63,7 +63,7 @@ aCurveBulAt
|
||||
-> Particle
|
||||
aCurveBulAt maycid col pos control targ hiteff width = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = \w -> mvGenBullet w . setVel
|
||||
, _ptUpdate = \w -> mvBullet w . setVel
|
||||
, _btVel' = V2 0 0
|
||||
, _btColor' = col
|
||||
, _btTrail' = [pos]
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{- Bullet update. -}
|
||||
module Dodge.Particle.Bullet.Update
|
||||
( mvGenBullet
|
||||
( mvBullet
|
||||
) where
|
||||
import Dodge.Data
|
||||
--import Dodge.Base
|
||||
import Dodge.WorldEvent.ThingsHit
|
||||
--import Picture
|
||||
import Geometry
|
||||
--import Geometry.Vector3D
|
||||
|
||||
import Control.Lens
|
||||
{-
|
||||
Update for a generic bullet.
|
||||
-}
|
||||
mvGenBullet :: World -> Particle -> (World, Maybe Particle)
|
||||
mvGenBullet w bt
|
||||
| t <= 0 = (w, Nothing)
|
||||
| t < 4 = (w, Just $ bt
|
||||
& btPassThrough' .~ Nothing
|
||||
& btTrail' .~ (p:p:ps)
|
||||
& btTimer' -~ 1
|
||||
)
|
||||
mvBullet :: World -> Particle -> (World, Maybe Particle)
|
||||
mvBullet w bt
|
||||
| t <= 0 = wAnd Nothing
|
||||
| t < 4 = wAnd $ Just $ bt
|
||||
& btPassThrough' .~ Nothing
|
||||
& btTrail' .~ (p:p:ps)
|
||||
& btTimer' -~ 1
|
||||
-- | otherwise = hiteff bt (thingsHitExceptCr3D' mcr (addZ 20 p) (addZ 20 (p +.+ vel)) w) w
|
||||
| otherwise = hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
|
||||
where
|
||||
wAnd = (w,)
|
||||
mcr = _btPassThrough' bt
|
||||
(p:ps) = _btTrail' bt
|
||||
vel = _btVel' bt
|
||||
|
||||
@@ -24,7 +24,7 @@ colSpark' randDir time col pos baseDir w = w
|
||||
dir = a + baseDir
|
||||
spark = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = mvGenBullet
|
||||
, _ptUpdate = mvBullet
|
||||
, _btVel' = rotateV dir (V2 5 0)
|
||||
, _btColor' = col
|
||||
, _btTrail' = [pos]
|
||||
|
||||
Reference in New Issue
Block a user