Allow for bullet drag

This commit is contained in:
2021-12-02 18:29:46 +00:00
parent 85ededc158
commit 8b8d75b016
35 changed files with 362 additions and 228 deletions
+6 -8
View File
@@ -10,23 +10,21 @@ import Dodge.WorldEvent.ThingsHit
import Geometry
--import Geometry.Vector3D
import Data.Bifunctor
import Control.Lens
{-
Update for a generic bullet.
-}
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
| t <= 0 || magV (_btVel' bt) < 1 = wAnd Nothing
| otherwise = second (fmap dodrag) $ hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
where
dodrag = btVel' %~ (drag *.*)
drag = _btDrag bt
wAnd = (w,)
mcr = _btPassThrough' bt
(p:ps) = _btTrail' bt
(p:_) = _btTrail' bt
vel = _btVel' bt
hiteff = _btHitEffect' bt
t = _btTimer' bt