Add in "linear" lWorld to separate time reversable worlds

This commit is contained in:
2022-10-28 12:24:51 +01:00
parent 5f6bd43599
commit 7e790b7153
130 changed files with 827 additions and 980 deletions
+3 -9
View File
@@ -11,22 +11,16 @@ import LensHelp
import Picture
import RandomHelp
--randParticleAt :: (Point2 -> State StdGen Particle) -> Point2 -> World -> World
--randParticleAt f p w = w
-- & instantParticles .:~ thepart
-- & randGen .~ g
-- where
-- (thepart,g) = runState (f p) (_randGen w)
randEnergyBallAt :: (Point2 -> State StdGen EnergyBall) -> Point2 -> World -> World
randEnergyBallAt f p w =
w
& cWorld . energyBalls .:~ thepart
& cWorld . lWorld . energyBalls .:~ thepart
& randGen .~ g
where
(thepart, g) = runState (f p) (_randGen w)
makeStaticBall :: Point2 -> World -> World
makeStaticBall p = randEnergyBallAt aStaticBall p . (cWorld . posEvents .:~ thesparker)
makeStaticBall p = randEnergyBallAt aStaticBall p . (cWorld . lWorld . posEvents .:~ thesparker)
where
thesparker = PosEvent SparkSpawner 10 p
@@ -92,7 +86,7 @@ makeGasCloud ::
World
makeGasCloud pos vel w =
w
& cWorld . clouds .:~ theCloud
& cWorld . lWorld . clouds .:~ theCloud
& randGen .~ g
where
theCloud =