Tweak sparks
This commit is contained in:
@@ -34,7 +34,7 @@ defaultAimParams = AimParams
|
||||
, _aimStance = OneHand
|
||||
}
|
||||
useAmmoParams :: Maybe Float -> Item -> Creature -> World -> World
|
||||
useAmmoParams vfact it cr w = w & particles .:~ aBulAt
|
||||
useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
|
||||
vfact
|
||||
thetraj -- extra update
|
||||
Nothing -- color (default)
|
||||
|
||||
@@ -255,7 +255,7 @@ updateArc :: ItemParams
|
||||
updateArc = createNewArc
|
||||
|
||||
shootLaser :: Item -> Creature -> World -> World
|
||||
shootLaser it cr = particles .:~ lasRayAt phasev pos dir
|
||||
shootLaser it cr = instantParticles .:~ lasRayAt phasev pos dir
|
||||
where
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
|
||||
@@ -68,7 +68,7 @@ colSparkRandDir :: Float -> Int -> Color -> Point2 -> Float -> World -> World
|
||||
colSparkRandDir randDir time col pos baseDir w = w
|
||||
& instantParticles .:~ spark
|
||||
& randGen .~ g
|
||||
where
|
||||
where
|
||||
(a,g) = randomR (-randDir,randDir) $ _randGen w
|
||||
dir = a + baseDir
|
||||
spark = BulletPt
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ updateInstantParticles :: World -> World
|
||||
updateInstantParticles w = case _instantParticles w of
|
||||
[] -> w
|
||||
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 f up = f %~ IM.mapMaybe (dbArg up)
|
||||
|
||||
@@ -5,14 +5,13 @@ import Dodge.Particle.Bullet.Spawn
|
||||
import Dodge.Wall.Reflect
|
||||
import Dodge.Wall.Dust
|
||||
import Geometry
|
||||
import Color
|
||||
import LensHelp
|
||||
|
||||
import Control.Monad.State
|
||||
|
||||
defaultWallDamage :: Damage -> Wall -> World -> World
|
||||
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)
|
||||
. wlDustAt wl outTo
|
||||
Blunt -> wlDustAt wl outTo
|
||||
@@ -27,9 +26,9 @@ defaultWallDamage dm wl = wallDamageEffect dm wl . case _dmType dm of
|
||||
PoisonDam -> id
|
||||
where
|
||||
sp = _dmFrom dm
|
||||
p = _dmTo dm
|
||||
p = _dmAt dm
|
||||
outTo = p +.+ squashNormalizeV (sp -.- p)
|
||||
pSparkCol = brightX 100 1.5 white
|
||||
pSparkCol = V4 5 1 0.5 2
|
||||
lSparkCol = V4 20 (-5) 0 1
|
||||
|
||||
wallDamageEffect :: Damage -> Wall -> World -> World
|
||||
@@ -37,8 +36,8 @@ wallDamageEffect dm wl w = case _dmEffect dm of
|
||||
BounceBullet bt -> w & 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}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user