Work on sensor machines, remove some datatypes associated with placements
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
module Dodge.Particle.Spark
|
||||
( colSpark
|
||||
, colSpark'
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Data.DamageType
|
||||
import Dodge.Particle.Bullet.Draw
|
||||
import Dodge.Particle.Bullet.Update
|
||||
import Dodge.WorldEvent.HitEffect
|
||||
import Dodge.Creature.State.Data
|
||||
import Color
|
||||
import Geometry
|
||||
|
||||
import System.Random
|
||||
import Control.Lens
|
||||
|
||||
colSpark :: Int -> Color -> Point2 -> Float -> World -> World
|
||||
colSpark = colSpark' 0.7
|
||||
colSpark' :: Float -> Int -> Color -> Point2 -> Float -> World -> World
|
||||
colSpark' randDir time col pos baseDir w = w
|
||||
& worldEvents %~ ( over particles (spark :) . )
|
||||
& randGen .~ g
|
||||
where
|
||||
(a,g) = randomR (-randDir,randDir) $ _randGen w
|
||||
dir = a + baseDir
|
||||
spark = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = mvGenBullet
|
||||
, _btVel' = rotateV dir (V2 5 0)
|
||||
, _btColor' = col
|
||||
, _btTrail' = [pos]
|
||||
, _btPassThrough' = Nothing
|
||||
, _btWidth' = 1
|
||||
, _btTimer' = time
|
||||
, _btHitEffect' = destroyOnImpact sparkEff noEff
|
||||
}
|
||||
sparkEff bt p cr = creatures . ix (_crID cr) . crState . crDamage %~ ( SparkDam 1 sp p ep : )
|
||||
where
|
||||
sp = head (_btTrail' bt)
|
||||
ep = sp +.+ _btVel' bt
|
||||
Reference in New Issue
Block a user