Stop bullets when they hit walls
This commit is contained in:
@@ -15,13 +15,13 @@ import Control.Lens
|
||||
{- Update for a generic bullet. -}
|
||||
mvBullet :: World -> Particle -> (World, Maybe Particle)
|
||||
mvBullet w bt'
|
||||
| t <= 0 || magV (_btVel' bt) < 1 = wAnd Nothing
|
||||
| otherwise = second (fmap dodrag) $ hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
|
||||
| t <= 0 || magV (_btVel' bt) < 1 = (w,Nothing)
|
||||
| otherwise = second (fmap dodrag) $
|
||||
hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
|
||||
where
|
||||
bt = foldr (\mg b -> _mgField mg mg b) bt' $ _magnets w
|
||||
dodrag = btVel' %~ (drag *.*)
|
||||
drag = _btDrag bt
|
||||
wAnd = (w,)
|
||||
mcr = _btPassThrough' bt
|
||||
(p:_) = _btTrail' bt
|
||||
vel = _btVel' bt
|
||||
|
||||
Reference in New Issue
Block a user