Add basic booster
This commit is contained in:
@@ -60,7 +60,7 @@ bulBounceArmCr' bt p cr w
|
||||
pOut = p +.+ 2 *.* newDir
|
||||
reflectVel = magV bulVel *.* newDir
|
||||
addBouncer = worldEvents %~ ( over particles (bouncer :) . )
|
||||
bouncer = (aGenBulAt Nothing (_btColor' bt) pOut reflectVel
|
||||
bouncer = (aGenBulAt Nothing pOut reflectVel
|
||||
(_btHitEffect' bt) (_btWidth' bt)
|
||||
) {_btTimer' = _btTimer' bt - 1}
|
||||
{- | Bullet pass through creatures. -}
|
||||
@@ -83,7 +83,7 @@ bulPenCr' bt p cr w
|
||||
sp = head $ _btTrail' bt
|
||||
ep = sp +.+ _btVel' bt
|
||||
addPiercer = over particles (piercer :)
|
||||
piercer = (aGenBulAt (Just cid) (_btColor' bt) p (_btVel' bt)
|
||||
piercer = (aGenBulAt (Just cid) p (_btVel' bt)
|
||||
(_btHitEffect' bt) (_btWidth' bt)
|
||||
) {_btTimer' = _btTimer' bt - 1}
|
||||
{- | Heavy bullet effects when hitting creature:
|
||||
@@ -149,7 +149,7 @@ bulBounceWall' bt p wl w = damageBlocksBy 5 wl $ over worldEvents addBouncer w
|
||||
where
|
||||
sp = head $ _btTrail' bt
|
||||
pOut = p +.+ safeNormalizeV (sp -.- p)
|
||||
bouncer = (aGenBulAt Nothing (_btColor' bt) pOut reflectVel
|
||||
bouncer = (aGenBulAt Nothing pOut reflectVel
|
||||
(_btHitEffect' bt) (_btWidth' bt)
|
||||
) {_btTimer' = _btTimer' bt - 1}
|
||||
wallV = uncurry (-.-) (_wlLine wl)
|
||||
|
||||
@@ -10,15 +10,14 @@ import Control.Lens
|
||||
|
||||
aGenBulAt
|
||||
:: Maybe Int -- ^ Pass-through creature id
|
||||
-> Color
|
||||
-> Point2 -- ^ Start position
|
||||
-> Point2 -- ^ Velocity
|
||||
-> HitEffect
|
||||
-> Float -- ^ Bullet width
|
||||
-> Particle
|
||||
aGenBulAt maycid _ pos vel hiteff width = Bul'
|
||||
aGenBulAt maycid pos vel hiteff width = Bul'
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate' = mvGenBullet'
|
||||
, _ptUpdate' = mvGenBullet
|
||||
, _btVel' = vel
|
||||
, _btColor' = white
|
||||
, _btTrail' = [pos]
|
||||
@@ -39,7 +38,7 @@ aCurveBulAt
|
||||
-> Particle
|
||||
aCurveBulAt maycid col pos control targ hiteff width = Bul'
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate' = \w -> mvGenBullet' w . setVel
|
||||
, _ptUpdate' = \w -> mvGenBullet w . setVel
|
||||
, _btVel' = (0,0)
|
||||
, _btColor' = col
|
||||
, _btTrail' = [pos]
|
||||
|
||||
@@ -18,8 +18,8 @@ import Control.Lens
|
||||
{-
|
||||
Update for a generic bullet.
|
||||
-}
|
||||
mvGenBullet' :: World -> Particle -> (World, Maybe Particle)
|
||||
mvGenBullet' w bt
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user