Refactor, try to limit dependencies
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user