Tweak sparks

This commit is contained in:
2022-03-25 15:09:04 +00:00
parent 59b49956b5
commit bd46d3f110
5 changed files with 9 additions and 10 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ defaultAimParams = AimParams
, _aimStance = OneHand , _aimStance = OneHand
} }
useAmmoParams :: Maybe Float -> Item -> Creature -> World -> World useAmmoParams :: Maybe Float -> Item -> Creature -> World -> World
useAmmoParams vfact it cr w = w & particles .:~ aBulAt useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
vfact vfact
thetraj -- extra update thetraj -- extra update
Nothing -- color (default) Nothing -- color (default)
+1 -1
View File
@@ -255,7 +255,7 @@ updateArc :: ItemParams
updateArc = createNewArc updateArc = createNewArc
shootLaser :: Item -> Creature -> World -> World shootLaser :: Item -> Creature -> World -> World
shootLaser it cr = particles .:~ lasRayAt phasev pos dir shootLaser it cr = instantParticles .:~ lasRayAt phasev pos dir
where where
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
dir = _crDir cr dir = _crDir cr
+1 -1
View File
@@ -68,7 +68,7 @@ colSparkRandDir :: Float -> Int -> Color -> Point2 -> Float -> World -> World
colSparkRandDir randDir time col pos baseDir w = w colSparkRandDir randDir time col pos baseDir w = w
& instantParticles .:~ spark & instantParticles .:~ spark
& randGen .~ g & randGen .~ g
where where
(a,g) = randomR (-randDir,randDir) $ _randGen w (a,g) = randomR (-randDir,randDir) $ _randGen w
dir = a + baseDir dir = a + baseDir
spark = BulletPt spark = BulletPt
+1 -1
View File
@@ -146,7 +146,7 @@ updateInstantParticles :: World -> World
updateInstantParticles w = case _instantParticles w of updateInstantParticles w = case _instantParticles w of
[] -> w [] -> w
ps -> let (w',ps') = mapAccumR (\a b -> _ptUpdate b a b) (w {_instantParticles=[]}) ps ps -> let (w',ps') = mapAccumR (\a b -> _ptUpdate b a b) (w {_instantParticles=[]}) ps
in updateInstantParticles $ w' & particles %~ (catMaybes ps' ++) in updateInstantParticles $ w' & particles .++~ catMaybes ps'
updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> World updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> World
updateMIM f up = f %~ IM.mapMaybe (dbArg up) updateMIM f up = f %~ IM.mapMaybe (dbArg up)
+5 -6
View File
@@ -5,14 +5,13 @@ import Dodge.Particle.Bullet.Spawn
import Dodge.Wall.Reflect import Dodge.Wall.Reflect
import Dodge.Wall.Dust import Dodge.Wall.Dust
import Geometry import Geometry
import Color
import LensHelp import LensHelp
import Control.Monad.State import Control.Monad.State
defaultWallDamage :: Damage -> Wall -> World -> World defaultWallDamage :: Damage -> Wall -> World -> World
defaultWallDamage dm wl = wallDamageEffect 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) Lasering -> colSparkRandDir 0.2 8 lSparkCol outTo (reflDirWall sp p wl)
Piercing -> colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl) Piercing -> colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl)
. wlDustAt wl outTo . wlDustAt wl outTo
Blunt -> wlDustAt wl outTo Blunt -> wlDustAt wl outTo
@@ -27,9 +26,9 @@ defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of
PoisonDam -> id PoisonDam -> id
where where
sp = _dmFrom dm sp = _dmFrom dm
p = _dmTo dm p = _dmAt dm
outTo = p +.+ squashNormalizeV (sp -.- p) outTo = p +.+ squashNormalizeV (sp -.- p)
pSparkCol = brightX 100 1.5 white pSparkCol = V4 5 1 0.5 2
lSparkCol = V4 20 (-5) 0 1 lSparkCol = V4 20 (-5) 0 1
wallDamageEffect :: Damage -> Wall -> World -> World wallDamageEffect :: Damage -> Wall -> World -> World
@@ -37,8 +36,8 @@ wallDamageEffect dm wl w = case _dmEffect dm of
BounceBullet bt -> w & instantParticles .:~ thebouncer BounceBullet bt -> w & instantParticles .:~ thebouncer
where where
reflectVel = reflVelWall wl (_ptVel bt) reflectVel = reflVelWall wl (_ptVel bt)
thebouncer = (aBulAt Nothing id (Just (_ptColor bt)) Nothing pOut reflectVel (_btDrag bt) (_ptHitEff bt) (_ptWidth bt) thebouncer = aBulAt Nothing id (Just (_ptColor bt)) Nothing pOut reflectVel (_btDrag bt) (_ptHitEff bt) (_ptWidth bt)
) {_ptTimer = _ptTimer bt - 1} & ptTimer .~ _ptTimer bt - 1
pOut = p +.+ squashNormalizeV (sp -.- p) pOut = p +.+ squashNormalizeV (sp -.- p)
p = _dmAt dm p = _dmAt dm
sp = _dmFrom dm sp = _dmFrom dm