Start to move damage effects of bullets into a more sensible place

This commit is contained in:
2022-03-25 09:45:11 +00:00
parent 41ad289de2
commit af6cdfd048
7 changed files with 102 additions and 99 deletions
+15 -1
View File
@@ -1,13 +1,15 @@
module Dodge.Wall.DamageEffect where
import Dodge.Data
import Dodge.Particle.Spark
import Dodge.Particle.Bullet.Spawn
import Dodge.Wall.Reflect
import Dodge.Wall.Dust
import Geometry
import Color
import LensHelp
defaultWallDamage :: Damage -> Wall -> World -> World
defaultWallDamage dm wl = case _dmType dm of
defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of
Lasering -> colSpark 8 lSparkCol outTo (reflDirWall sp p wl)
Piercing -> colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl)
. wlDustAt wl outTo
@@ -27,3 +29,15 @@ defaultWallDamage dm wl = case _dmType dm of
outTo = p +.+ squashNormalizeV (sp -.- p)
pSparkCol = brightX 100 1.5 white
lSparkCol = V4 20 (-5) 0 1
wallDamageEffect :: Damage -> Wall -> World -> World
wallDamageEffect dm wl = case _dmEffect dm of
BounceBullet bt -> instantParticles .:~ thebouncer
where
reflectVel = reflVelWall wl (_ptVel bt)
thebouncer = (aBulAt Nothing id (Just (_ptColor bt)) Nothing pOut reflectVel (_btDrag bt) (_ptHitEff bt) (_ptWidth bt)
) {_ptTimer = _ptTimer bt - 1}
pOut = p +.+ squashNormalizeV (sp -.- p)
p = _dmAt dm
sp = _dmFrom dm
_ -> id