Move bullets into own data type
This commit is contained in:
@@ -42,20 +42,24 @@ applyDamageEffect dm de cr w = case de of
|
||||
& creatures . ix (_crID cr) . crPos .+.+~ (1/_crMass cr) *.* pback
|
||||
TorqueDamage rot -> w
|
||||
& creatures . ix (_crID cr) . crDir +~ rot
|
||||
BounceBullet bt | crIsArmouredFrom p cr -> w & instantParticles .:~ bouncer
|
||||
BounceBullet bt | crIsArmouredFrom p cr -> w & instantBullets .:~ bouncer
|
||||
where
|
||||
bouncer = (aBulAt Nothing id (Just (_ptColor bt)) pOut reflectVel (_btDrag bt)
|
||||
(_ptHitEff bt) (_ptWidth bt)
|
||||
) {_ptTimer = _ptTimer bt - 1}
|
||||
bouncer = (aBulAt Nothing id (Just (_buColor bt)) pOut reflectVel (_buDrag bt)
|
||||
(_buHitEff bt) (_buWidth bt)
|
||||
) {_buTimer = _buTimer bt - 1}
|
||||
pOut = p +.+ 2 *.* newDir
|
||||
reflectVel = magV bulVel *.* newDir
|
||||
newDir = squashNormalizeV (p -.- _crPos cr)
|
||||
bulVel = _ptVel bt
|
||||
bulVel = _buVel bt
|
||||
BounceBullet _ -> w
|
||||
DamageSpawn f -> w & instantParticles .:~ thepart
|
||||
& randGen .~ g
|
||||
where
|
||||
(thepart,g) = runState (f (Left cr) dm) $ _randGen w
|
||||
DamageSpawn' f -> w & instantBullets .:~ thepart
|
||||
& randGen .~ g
|
||||
where
|
||||
(thepart,g) = runState (f (Left cr) dm) $ _randGen w
|
||||
NoDamageEffect -> w
|
||||
where
|
||||
fromDir = _dmFrom dm
|
||||
|
||||
Reference in New Issue
Block a user