Add dust on bullet wall hit

This commit is contained in:
2021-09-13 12:23:51 +01:00
parent b27c174d93
commit 29f048cfdd
15 changed files with 93 additions and 68 deletions
+5 -2
View File
@@ -17,6 +17,7 @@ import Dodge.WorldEvent.Shockwave
import Dodge.Creature.State.Data
import Dodge.Creature.Property
import Geometry
import Geometry.Vector3D
import Picture
import System.Random
@@ -137,11 +138,13 @@ bulConCr' bt p cr w
mkwave = over worldEvents $ (.) (makeShockwaveAt [] p 15 4 1 white)
{- | Hitting wall effects: create a spark, damage blocks. -}
bulHitWall' :: Particle -> Point2 -> Wall -> World -> World
bulHitWall' bt p x w = damageBlocksBy 5 x
$ createSparkCol 8 theCol pOut (reflectDir x)
bulHitWall' bt p wl w = damageBlocksBy 5 wl
. smokeCloudAt dustcol 20 200 1 (addZ 20 pOut)
$ createSparkCol 8 theCol pOut (reflectDir wl)
$ set randGen g
w
where
dustcol = _wlColor wl & _4 .~ 1
theCol = brightX 100 1.5 white
sp = head $ _btTrail' bt
pOut = p +.+ safeNormalizeV (sp -.- p)