Add z level to energy balls
This commit is contained in:
@@ -19,6 +19,8 @@ import Geometry
|
||||
import LensHelp
|
||||
import Picture
|
||||
import RandomHelp
|
||||
import Linear.V3
|
||||
import Linear.Metric
|
||||
|
||||
makePoisonExplosionAt ::
|
||||
-- | Position
|
||||
@@ -68,8 +70,8 @@ makeFlameExplosionAt p w =
|
||||
-- the ( Nthing :: Maybe Int ) here is "maybe" a creature id that the
|
||||
-- particle passes through for the first frame of its existence
|
||||
|
||||
makeExplosionAt :: Point2 -> Point2 -> World -> World
|
||||
makeExplosionAt p vel w =
|
||||
makeExplosionAt :: Point3 -> Point3 -> World -> World
|
||||
makeExplosionAt p' vel' w =
|
||||
w
|
||||
& soundStart (Explosion (w ^. cWorld . lWorld . lClock)) (p) bangS Nothing
|
||||
& addFlames
|
||||
@@ -77,13 +79,15 @@ makeExplosionAt p vel w =
|
||||
.:~ MakeTempLight (LSParam (addZ 20 p) 150 (V3 1 0.5 0)) 20
|
||||
& makeShockwaveAt [] p 50 50 1 white
|
||||
where
|
||||
fVs = replicateM 100 (randInCirc 1) & evalState $ _randGen w
|
||||
fPs' = replicateM 100 (randInCirc 5) & evalState $ _randGen w
|
||||
p = p' ^. _xy
|
||||
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
|
||||
fPs' = fmap (`v2z` 0) $ replicateM 100 (randInCirc 5) & evalState $ _randGen w
|
||||
fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
|
||||
inversePushOut v = (15 - magV v) * 0.01 *.* v
|
||||
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
|
||||
inversePushOut v = (15 - norm v) * 0.01 *.*.* v
|
||||
fVs' = zipWith (+.+.+) fVs $ map inversePushOut fPs'
|
||||
sizes = randomRs (2, 9) $ _randGen w
|
||||
times = randomRs (15, 20) $ _randGen w
|
||||
mF q v damp size time = makeFlamelet (q - (2*v + 2* vel)) (v + damp *.* vel) size time
|
||||
newFs = zipWith4 (mF p) (zipWith (+) fPs' (fmap (3 *.*) fVs')) fdamps sizes times
|
||||
mF q v damp size time = makeFlamelet
|
||||
(q - (2*v + 2* vel')) (v + damp *.*.* vel') size time
|
||||
newFs = zipWith4 (mF p') (zipWith (+) fPs' (fmap (3 *.*.*) fVs')) fdamps sizes times
|
||||
addFlames w' = foldl' (flip ($)) w' newFs
|
||||
|
||||
Reference in New Issue
Block a user