Add source files, commit before reverting pictures to lists
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
module Dodge.Smoke where
|
||||
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
import Dodge.RandomHelp
|
||||
import Geometry.Data
|
||||
import Picture
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
|
||||
spawnSmokeAt :: Point2 -> World -> World
|
||||
spawnSmokeAt p w =
|
||||
w & smoke %~ (:) thesmoke
|
||||
& randGen .~ g
|
||||
where
|
||||
thesmoke = Smoke
|
||||
{_smPos = p
|
||||
,_smRad = 20
|
||||
,_smColor = white
|
||||
,_smUpdate = f
|
||||
,_smPs = ps
|
||||
,_smTime = 500
|
||||
}
|
||||
f s = case s ^. smPs of
|
||||
[] -> Nothing
|
||||
_ -> case s ^. smTime of
|
||||
0 -> Just $ s & smPs %~ init
|
||||
t -> Just $ s & smTime .~ t-1
|
||||
(ps,g) = runState (sequence $ replicate 60 $ randInCirc 20) $ _randGen w
|
||||
|
||||
spawnSmokeAtCursor :: World -> World
|
||||
spawnSmokeAtCursor w = spawnSmokeAt (mouseWorldPos w) w
|
||||
Reference in New Issue
Block a user