Add source files, commit before reverting pictures to lists

This commit is contained in:
2021-02-15 00:07:55 +01:00
parent c6bcfacc7a
commit 8447844bcd
41 changed files with 13677 additions and 35 deletions
+33
View File
@@ -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