Tweak explosions

This commit is contained in:
2024-12-24 15:25:39 +00:00
parent 957f233629
commit e82ef26b3e
4 changed files with 11 additions and 18 deletions
+2 -4
View File
@@ -17,8 +17,6 @@ import RandomHelp
makeFlamelet :: makeFlamelet ::
-- | Position -- | Position
Point2 -> Point2 ->
-- | z position
Float ->
-- | Velocity -- | Velocity
Point2 -> Point2 ->
-- | Size -- | Size
@@ -27,7 +25,7 @@ makeFlamelet ::
Int -> Int ->
World -> World ->
World World
makeFlamelet (V2 x y) z vel size time w = makeFlamelet (V2 x y) vel size time w =
w w
& randGen .~ g & randGen .~ g
& cWorld . lWorld . energyBalls & cWorld . lWorld . energyBalls
@@ -50,7 +48,7 @@ updateEnergyBall w eb
| otherwise = | otherwise =
( ebFlicker eb $ uncurry (damageCircle 5 (_ebPos eb)) (_ebEff eb) w ( ebFlicker eb $ uncurry (damageCircle 5 (_ebPos eb)) (_ebEff eb) w
-- , Just $ eb & ebTimer -~ 1 & ebPos .+.+~ _ebVel eb & ebVel .*.*~ 0.9 -- , Just $ eb & ebTimer -~ 1 & ebPos .+.+~ _ebVel eb & ebVel .*.*~ 0.9
, Just $ eb & ebTimer -~ 1 & ebPos .~ bp & ebVel .~ 0.7 * bv , Just $ eb & ebTimer -~ 1 & ebPos .~ bp & ebVel .~ 0.8 * bv
) )
where where
p = eb ^. ebPos + eb ^. ebVel p = eb ^. ebPos + eb ^. ebVel
+1 -1
View File
@@ -77,7 +77,7 @@ doThrust pj w =
& randGen .~ g & randGen .~ g
& cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v) & cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1) & soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& makeFlamelet (oldPos -.- vel) 0 (vel +.+ rotateV (pi + sparkD) accel) 3 10 & makeFlamelet (oldPos -.- vel) (vel +.+ rotateV (pi + sparkD) accel) 3 10
& shellTrailCloud trailage trailfadetime & shellTrailCloud trailage trailfadetime
(addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos))) (addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)))
where where
+1 -1
View File
@@ -27,7 +27,7 @@ import qualified Data.Map.Strict as M
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit u = testStringInit u =
(map show $ u ^. uvWorld . cWorld . lWorld . oldMagnets) (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls)
-- <> -- <>
-- (foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . bullets) -- (foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . bullets)
-- fromMaybe mempty $ do -- fromMaybe mempty $ do
+7 -12
View File
@@ -74,23 +74,18 @@ makeExplosionAt p vel w =
w w
& soundMultiFrom [Explosion 0, Explosion 1] p bangS Nothing & soundMultiFrom [Explosion 0, Explosion 1] p bangS Nothing
& addFlames & addFlames
-- & cWorld . lWorld . tempLightSources .:~ theTLS & cWorld . lWorld . worldEvents
& cWorld . lWorld . worldEvents .:~ thels .:~ MakeTempLight (LSParam (addZ 20 p) 150 (V3 1 0.5 0)) 20
& makeShockwaveAt [] p 50 50 1 white & makeShockwaveAt [] p 50 50 1 white
where where
thels = MakeTempLight (LSParam (addZ 20 p) 150 (V3 1 0.5 0)) 20
-- theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p)
fVs = replicateM 100 (randInCirc 1) & evalState $ _randGen w fVs = replicateM 100 (randInCirc 1) & evalState $ _randGen w
--fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w fPs' = replicateM 100 (randInCirc 5) & evalState $ _randGen w
fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
(fPs', zs) =
let (a, b, c) = unzip3 $ map fromV3 fPs''
in (zipWith V2 a b, c)
--fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs'
inversePushOut v = (15 - magV v) * 0.01 *.* v inversePushOut v = (15 - magV v) * 0.01 *.* v
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs' fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2, 9) $ _randGen w sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w times = randomRs (15, 20) $ _randGen w
mF q z v size time = makeFlamelet (q - vel) z (v + vel) size time mF q v size time = makeFlamelet (q - vel) (v + vel) size time
newFs = zipWith4 (mF p) zs (zipWith ((+) . xyV3) fPs'' (fmap (3 *.*) fVs')) sizes times newFs = zipWith3 (mF p) (zipWith (+) fPs' (fmap (3 *.*) fVs')) sizes times
-- newFs = zipWith3 (mF p) (fmap (3 *.*) fVs') sizes times
-- newFs = zipWith3 (mF p) fPs' sizes times
addFlames w' = foldl' (flip ($)) w' newFs addFlames w' = foldl' (flip ($)) w' newFs