Cleanup, fix menu lock on restarting level after game over

This commit is contained in:
2021-12-06 23:44:10 +00:00
parent 19540bd19e
commit 763b771928
18 changed files with 88 additions and 119 deletions
+2 -49
View File
@@ -1,61 +1,14 @@
module Dodge.WorldEvent
( module Dodge.WorldEvent
, module Dodge.WorldEvent.Flash
( module Dodge.WorldEvent.Flash
, module Dodge.WorldEvent.ThingsHit
, module Dodge.WorldEvent.Cloud
, module Dodge.WorldEvent.HitEffect
, module Dodge.WorldEvent.Explosion
, module Dodge.WorldEvent.SpawnParticle
)
where
import Dodge.Particle.Bullet.Draw
import Dodge.Particle.Bullet.Update
) where
import Dodge.WorldEvent.Flash
import Dodge.WorldEvent.ThingsHit
import Dodge.WorldEvent.Cloud
import Dodge.WorldEvent.HitEffect
import Dodge.WorldEvent.Explosion
import Dodge.WorldEvent.SpawnParticle
import Dodge.LightSource
import Dodge.Creature.State.Data
import Dodge.Data
import Geometry
import Color
import LensHelp
--import Control.Lens
import System.Random
import qualified Data.IntMap.Strict as IM
createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World
createBarrelSpark pos dir maycid time colid w = w
& worldEvents %~ (( over particles (spark :) . sparkFlashAt pos') . )
where
spark = BulletPt
{ _ptDraw = drawBul
, _ptUpdate = mvBullet
, _btVel' = rotateV dir (V2 5 0)
, _btDrag = 0.9
, _btColor' = numColor colid
, _btTrail' = [pos]
, _btPassThrough' = maycid
, _btWidth' = 1
, _btTimer' = time
, _btHitEffect' = destroyOnImpact sparkEff noEff
}
x = fst $ randomR (0,20) $ _randGen w
pos' = pos +.+ rotateV dir (V2 x 0)
sparkEff bt p cr = creatures . ix (_crID cr) . crState . crDamage .:~ SparkDam 1 sp p ep
where
sp = head (_btTrail' bt)
ep = sp +.+ _btVel' bt
damCrsOnLine :: Int -> Point2 -> Point2 -> World -> World
damCrsOnLine dam p1 p2 = creatures %~ IM.map damIfOnLine
where
damIfOnLine cr
| circOnSeg p1 p2 (_crPos cr) (_crRad cr) = cr & crHP -~ dam
| otherwise = cr
makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p