Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+9 -9
View File
@@ -1,17 +1,17 @@
module Dodge.PosEvent where
import Dodge.Data
import Color
import Control.Monad.State
import Dodge.Data.World
import Dodge.Spark
import Geometry.Data
import Color
import LensHelp
import Control.Monad.State
import RandomHelp
updatePosEvent :: World -> PosEvent -> (World, Maybe PosEvent)
updatePosEvent w pv
| _pvTimer pv < 1 = (w,Nothing)
| otherwise = (posEventEffect pv w,Just $ pv & pvTimer -~ 1)
| _pvTimer pv < 1 = (w, Nothing)
| otherwise = (posEventEffect pv w, Just $ pv & pvTimer -~ 1)
posEventEffect :: PosEvent -> World -> World
posEventEffect pv = case _pvType pv of
@@ -20,6 +20,6 @@ posEventEffect pv = case _pvType pv of
spawnElectricalSparks :: Point2 -> World -> World
spawnElectricalSparks = randSpark ELECTRICAL rspeed rcol rdir
where
rspeed = state (randomR (3,6))
rcol = brightX 100 1.5 <$> takeOne [white,azure,blue,cyan]
rdir = state $ randomR (0,2*pi)
rspeed = state (randomR (3, 6))
rcol = brightX 100 1.5 <$> takeOne [white, azure, blue, cyan]
rdir = state $ randomR (0, 2 * pi)