Remove old smoke code
This commit is contained in:
@@ -297,42 +297,6 @@ doFlameDam amount pt p cr = over (creatures . ix (_crID cr) . crState . crDamage
|
||||
where sp = _btPos' pt
|
||||
ep = sp +.+ _btVel' pt
|
||||
|
||||
makeColorSmokeAt :: Color -> Point2 -> Float -> Int -> Point2 -> World -> World
|
||||
makeColorSmokeAt col vel scal time p w = over projectiles (IM.insert n smP) w
|
||||
where n = newProjectileKey w
|
||||
smP = Projectile
|
||||
{ _ptPos = p
|
||||
, _ptStartPos = p
|
||||
, _ptVel = vel
|
||||
, _ptPict = onLayer PtLayer $ uncurry translate p $ color col $ circleSolid 1
|
||||
, _ptID = n
|
||||
, _ptUpdate = moveColorSmoke col scal time n
|
||||
}
|
||||
|
||||
moveColorSmoke :: Color -> Float -> Int -> Int -> World -> World
|
||||
moveColorSmoke col scal time i w
|
||||
| time > 0
|
||||
= set (projectiles . ix i . ptPict) pic
|
||||
. set (projectiles . ix i . ptUpdate) (moveColorSmoke col scal (time-1) i)
|
||||
. set (projectiles . ix i . ptPos) newPos
|
||||
. setVel
|
||||
$ w
|
||||
| time > -50
|
||||
= set (projectiles . ix i . ptPict) pi1
|
||||
. set (projectiles . ix i . ptUpdate) (moveColorSmoke col scal (time-1) i)
|
||||
. set (projectiles . ix i . ptPos) newPos
|
||||
. setVel
|
||||
$ w
|
||||
| otherwise
|
||||
= over projectiles (IM.delete i) w
|
||||
where oldPos = _ptPos $ _projectiles w IM.! i
|
||||
newPos = oldPos +.+ (_ptVel $ _projectiles w IM.! i)
|
||||
setVel = over (projectiles . ix i . ptVel) $ (*.*) 0.99
|
||||
pic = onLayer PtLayer $ uncurry translate newPos $ color col $ circleSolid $ (21 - fromIntegral time) * scal
|
||||
pi1 = onLayer PtLayer $ uncurry translate newPos
|
||||
$ color (withAlpha (1 + fromIntegral time /50) col)
|
||||
$ circleSolid $ 21 * scal
|
||||
|
||||
damCrsOnLine :: Int -> Point2 -> Point2 -> World -> World
|
||||
damCrsOnLine dam p1 p2 = over creatures (IM.map damIfOnLine)
|
||||
where damIfOnLine cr | circOnLine p1 p2 (_crPos cr) (_crRad cr)
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
module Dodge.WorldEvent.Smoke
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
import Control.Lens
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
makeColorSmokeAt :: Color -> Point2 -> Float -> Int -> Point2 -> World -> World
|
||||
makeColorSmokeAt col vel scal time p w = over projectiles (IM.insert n smP) w
|
||||
where n = newProjectileKey w
|
||||
smP = Projectile
|
||||
{ _ptPos = p
|
||||
, _ptStartPos = p
|
||||
, _ptVel = vel
|
||||
, _ptPict = setLayer 2 . setDepth 0 . uncurry translate p $ color col $ circleSolid 1
|
||||
, _ptID = n
|
||||
, _ptUpdate = moveColorSmoke col scal time n
|
||||
}
|
||||
|
||||
moveColorSmoke :: Color -> Float -> Int -> Int -> World -> World
|
||||
moveColorSmoke col scal time i w
|
||||
| time > 0
|
||||
= set (projectiles . ix i . ptPict) pic
|
||||
. set (projectiles . ix i . ptUpdate) (moveColorSmoke col scal (time-1) i)
|
||||
. set (projectiles . ix i . ptPos) newPos
|
||||
. setVel
|
||||
$ w
|
||||
| time > -50
|
||||
= set (projectiles . ix i . ptPict) pi1
|
||||
. set (projectiles . ix i . ptUpdate) (moveColorSmoke col scal (time-1) i)
|
||||
. set (projectiles . ix i . ptPos) newPos
|
||||
. setVel
|
||||
$ w
|
||||
| otherwise
|
||||
= over projectiles (IM.delete i) w
|
||||
where oldPos = _ptPos $ _projectiles w IM.! i
|
||||
newPos = oldPos +.+ (_ptVel $ _projectiles w IM.! i)
|
||||
setVel = over (projectiles . ix i . ptVel) $ (*.*) 0.99
|
||||
pic = setLayer 2 . setDepth 0 . uncurry translate newPos $ color col $ circleSolid $ (21 - fromIntegral time) * scal
|
||||
pi1 = setLayer 2 . setDepth 0 . uncurry translate newPos
|
||||
$ color (withAlpha (1 + fromIntegral time /50) col)
|
||||
$ circleSolid $ 21 * scal
|
||||
Reference in New Issue
Block a user