Move bullets into own data type
This commit is contained in:
@@ -19,10 +19,10 @@ import System.Random
|
||||
--import Control.Lens
|
||||
-- TODO remove/simplify this function
|
||||
createBarrelSpark :: Point2 -> Float -> Int -> Int -> World -> World
|
||||
createBarrelSpark pos dir time colid = instantParticles .:~ BulletPt
|
||||
{ _ptUpdate = mvBullet
|
||||
createBarrelSpark pos dir time colid = instantParticles .:~ PtSpark
|
||||
{ _ptUpdate = mvSpark
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _btDrag = 0.9
|
||||
, _ptDrag = 0.9
|
||||
, _ptColor = numColor colid
|
||||
, _ptTrail = [pos]
|
||||
, _ptWidth = 1
|
||||
@@ -48,9 +48,9 @@ randColDirTimeSpark randcol randdir randtime pos w = w
|
||||
d <- randdir
|
||||
t <- randtime
|
||||
return (c,d,t)
|
||||
spark = BulletPt
|
||||
{ _ptUpdate = mvBullet
|
||||
, _btDrag = 0.9
|
||||
spark = PtSpark
|
||||
{ _ptUpdate = mvSpark
|
||||
, _ptDrag = 0.9
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _ptColor = col
|
||||
, _ptTrail = [pos]
|
||||
@@ -66,9 +66,9 @@ colSparkRandDir randDir time col pos baseDir w = w
|
||||
where
|
||||
(a,g) = randomR (-randDir,randDir) $ _randGen w
|
||||
dir = a + baseDir
|
||||
spark = BulletPt
|
||||
{ _ptUpdate = mvBullet
|
||||
, _btDrag = 0.9
|
||||
spark = PtSpark
|
||||
{ _ptUpdate = mvSpark
|
||||
, _ptDrag = 0.9
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _ptColor = col
|
||||
, _ptTrail = [pos]
|
||||
|
||||
Reference in New Issue
Block a user