Files
loop/src/Dodge/Particle/Bullet/Update.hs
T
2021-05-19 13:46:19 +02:00

35 lines
855 B
Haskell

{-
Bullet update.
-}
module Dodge.Particle.Bullet.Update
where
import Dodge.Data
--import Dodge.Base
import Dodge.WorldEvent.ThingsHit
--import Picture
import Geometry
import Control.Lens
--import Data.Maybe
--import Data.List
--import Data.Bifunctor
--import qualified Data.IntMap.Strict as IM
{-
Update for a generic bullet.
-}
mvGenBullet' :: World -> Particle -> (World, Maybe Particle)
mvGenBullet' w bt
| t <= 0 = (w, Nothing)
| t < 4 = (w, Just $ set btPassThrough' Nothing
$ set btTrail' (p:p:ps)
$ set btTimer' (t-1) bt
)
| otherwise = hiteff bt (thingsHitExceptCr mcr p (p +.+ vel) w) w
where
mcr = _btPassThrough' bt
(p:ps) = _btTrail' bt
vel = _btVel' bt
hiteff = _btHitEffect' bt
t = _btTimer' bt