Cleanup
This commit is contained in:
+1
-2
@@ -51,8 +51,7 @@ teslaBeamCombine (p,(a,b,bm),(x,y,_)) w
|
||||
|
||||
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> Particle
|
||||
lasRayAt col dam phasev pos dir = LaserParticle
|
||||
{ _ptDraw = drawLaser
|
||||
, _ptUpdate = mvLaser phasev pos dir
|
||||
{ _ptUpdate = mvLaser phasev pos dir
|
||||
, _ptRange = 800
|
||||
, _ptDamage = dam
|
||||
, _ptPhaseV = phasev
|
||||
|
||||
+14
-28
@@ -640,16 +640,14 @@ data Particle
|
||||
-- , _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
-- }
|
||||
= RadarCircleParticle
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptTimer :: Int
|
||||
, _ptRad :: Float
|
||||
, _ptPos :: Point2
|
||||
, _ptColor :: Color
|
||||
}
|
||||
| LaserParticle
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptRange :: Float
|
||||
, _ptDamage :: Int
|
||||
, _ptColor :: Color
|
||||
@@ -657,28 +655,24 @@ data Particle
|
||||
, _ptPoints :: [Point2]
|
||||
}
|
||||
| PtTeslaArc
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptPoints :: [Point2]
|
||||
, _ptTimer :: Int
|
||||
, _ptColor :: Color
|
||||
}
|
||||
| PtTargetLaser
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptPoints :: [Point2]
|
||||
, _ptColor :: Color
|
||||
}
|
||||
-- | LinearParticle
|
||||
-- { _ptDraw :: Particle -> Picture
|
||||
-- , _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
-- { _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
-- , _ptPoints :: [Point2]
|
||||
-- , _ptTimer :: Int
|
||||
-- , _ptColor :: Color
|
||||
-- }
|
||||
| BulletPt
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _btDrag :: Float
|
||||
, _ptColor :: Color
|
||||
@@ -689,8 +683,7 @@ data Particle
|
||||
, _ptHitEff :: HitEffect
|
||||
}
|
||||
| PtFlame
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _ptColor :: Color
|
||||
, _ptPos :: Point2
|
||||
@@ -702,8 +695,7 @@ data Particle
|
||||
, _ptOriginalVel :: Point2
|
||||
}
|
||||
| PtIncBall
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _ptColor :: Color
|
||||
, _ptPos :: Point2
|
||||
@@ -715,8 +707,7 @@ data Particle
|
||||
, _ptRot :: Float
|
||||
}
|
||||
| PtStaticBall
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptVel :: Point2
|
||||
, _ptColor :: Color
|
||||
, _ptPos :: Point2
|
||||
@@ -727,15 +718,13 @@ data Particle
|
||||
, _ptZ :: Float
|
||||
}
|
||||
| PtMuzFlare
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptPoly :: [Point2]
|
||||
, _ptColor :: Color
|
||||
, _ptTran3 :: Point3
|
||||
}
|
||||
| PtCircFlare
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptColor :: Color
|
||||
, _ptAlpha :: Float
|
||||
, _ptTran3 :: Point3
|
||||
@@ -753,8 +742,7 @@ data Particle
|
||||
-- , _ptZ :: Float
|
||||
-- }
|
||||
| Shockwave
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptColor :: Color
|
||||
, _ptPos :: Point2
|
||||
, _ptRad :: Float
|
||||
@@ -764,8 +752,7 @@ data Particle
|
||||
, _ptTimer :: Int
|
||||
}
|
||||
| PtInvShockwave
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptColor :: Color
|
||||
, _ptPos :: Point2
|
||||
, _ptRad :: Float
|
||||
@@ -775,8 +762,7 @@ data Particle
|
||||
, _ptTimer :: Int
|
||||
}
|
||||
| ShockLine
|
||||
{ _ptDraw :: Particle -> Picture
|
||||
, _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
{ _ptUpdate :: World -> Particle -> (World, Maybe Particle)
|
||||
, _ptPointDirs :: [[(Point2,Float)]]
|
||||
, _ptTimer :: Int
|
||||
, _ptColor :: Color
|
||||
|
||||
@@ -15,16 +15,9 @@ makeLaserScope
|
||||
-> Float -- ^ Fraction of red/green
|
||||
-> Particle
|
||||
makeLaserScope p ep relFrac = PtTargetLaser
|
||||
{_ptDraw = const $ setLayer BloomLayer $ setDepth 20 $ pictures
|
||||
[lineAlphaThick 0.5 0.5
|
||||
,lineAlphaThick 0.2 1.5
|
||||
,lineAlphaThick 0.1 2
|
||||
]
|
||||
,_ptUpdate = \w pt -> (w, Just $ pt & ptUpdate .~ \w' _ -> (w',Nothing))
|
||||
{_ptUpdate = \w pt -> (w, Just $ pt & ptUpdate .~ \w' _ -> (w',Nothing))
|
||||
, _ptPoints = [p,ep]
|
||||
, _ptColor = col
|
||||
}
|
||||
where
|
||||
lineAlphaThick a w =
|
||||
color (withAlpha a $ mixColors relFrac (1-relFrac) red green) $ thickLine w [p,ep]
|
||||
col = mixColors relFrac (1-relFrac) red green
|
||||
|
||||
@@ -199,11 +199,7 @@ targetLaserUpdate _ cr w t
|
||||
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
|
||||
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
|
||||
addLaserPic = instantParticles .:~ PtTargetLaser
|
||||
{ _ptDraw = const $ setLayer BloomNoZWrite $ pictures
|
||||
[ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 5 (sp:ps)
|
||||
, setDepth 19.5 . color (brightX 5 1 col) $ thickLine 1 (sp:ps)
|
||||
]
|
||||
, _ptUpdate = ptSimpleTime 1
|
||||
{ _ptUpdate = ptSimpleTime 1
|
||||
, _ptPoints = (sp:ps)
|
||||
, _ptColor = col
|
||||
}
|
||||
|
||||
@@ -66,8 +66,7 @@ aSonicWave it cr = instantParticles .:~ sonicWave pos dir cpos
|
||||
|
||||
sonicWave :: Point2 -> Float -> Point2 -> Particle
|
||||
sonicWave pos dir cpos = ShockLine
|
||||
{ _ptDraw = drawSonicWave
|
||||
, _ptUpdate = mvSonicWave
|
||||
{ _ptUpdate = mvSonicWave
|
||||
, _ptPointDirs = [[makePointDir $ pos +.+ clockOrth,makePointDir $ pos -.- clockOrth]]
|
||||
, _ptTimer = 1000
|
||||
, _ptColor = white
|
||||
|
||||
@@ -31,26 +31,12 @@ aRadarPulse :: (Point2 -> Float -> World -> [Point2])
|
||||
-> Creature
|
||||
-> World -> World
|
||||
aRadarPulse blipsF bf col cr = instantParticles .:~ RadarCircleParticle
|
||||
{ _ptDraw = drawPulse col
|
||||
, _ptUpdate = mvRadar blipsF bf col (_crPos cr)
|
||||
{ _ptUpdate = mvRadar blipsF bf col (_crPos cr)
|
||||
, _ptTimer = 100
|
||||
, _ptRad = 0
|
||||
, _ptPos = _crPos cr
|
||||
, _ptColor = col
|
||||
}
|
||||
drawPulse :: Color -> Particle -> Picture
|
||||
drawPulse col pt = setLayer DebugLayer $ pictures sweepPics
|
||||
where
|
||||
p = _ptPos pt
|
||||
r = _ptRad pt
|
||||
sweepPics = [colHelper 0.1 $ uncurryV translate p $ thickCircle r 15
|
||||
,colHelper 0.06 $ uncurryV translate p $ thickCircle (r-5) 5
|
||||
,colHelper 0.03 $ uncurryV translate p $ thickCircle (r-10) 5
|
||||
]
|
||||
colHelper y = color (withAlpha (y * globalAlpha) col)
|
||||
globalAlpha | x > 10 = 1
|
||||
| otherwise = fromIntegral x / 10
|
||||
x = _ptTimer pt
|
||||
{- | Radar blip at a point. -}
|
||||
blipAt :: Float -> Point2 -> Color -> Int -> RadarBlip
|
||||
blipAt r p col i = RadarBlip
|
||||
|
||||
@@ -2,7 +2,6 @@ module Dodge.Particle.Bullet.Spawn
|
||||
( aBulAt
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.Bullet.Draw
|
||||
import Dodge.Particle.Bullet.Update
|
||||
import Geometry
|
||||
import Picture
|
||||
@@ -23,8 +22,7 @@ aBulAt
|
||||
-> Float -- ^ Bullet width
|
||||
-> Particle
|
||||
aBulAt vfact updatemod mcol maycid pos vel drag hiteff width = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = theupdate
|
||||
{ _ptUpdate = theupdate
|
||||
, _ptVel = fromMaybe 1 vfact *.* vel
|
||||
, _btDrag = drag
|
||||
, _ptColor = fromMaybe (V4 200 200 200 2) mcol
|
||||
|
||||
@@ -6,7 +6,6 @@ module Dodge.Particle.Spark
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.HitEffect.ExpireAndDamage
|
||||
import Dodge.Particle.Bullet.Draw
|
||||
import Dodge.Particle.Damage
|
||||
--import Dodge.Particle.Bullet.HitEffect
|
||||
import Dodge.Particle.Bullet.Update
|
||||
@@ -21,8 +20,7 @@ import System.Random
|
||||
-- TODO remove/simplify this function
|
||||
createBarrelSpark :: Point2 -> Float -> Maybe Int -> Int -> Int -> World -> World
|
||||
createBarrelSpark pos dir maycid time colid = instantParticles .:~ BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = mvBullet
|
||||
{ _ptUpdate = mvBullet
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _btDrag = 0.9
|
||||
, _ptColor = numColor colid
|
||||
@@ -52,8 +50,7 @@ randColDirTimeSpark randcol randdir randtime pos w = w
|
||||
t <- randtime
|
||||
return (c,d,t)
|
||||
spark = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
, _ptUpdate = mvBullet
|
||||
{ _ptUpdate = mvBullet
|
||||
, _btDrag = 0.9
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _ptColor = col
|
||||
@@ -72,9 +69,7 @@ colSparkRandDir randDir time col pos baseDir w = w
|
||||
(a,g) = randomR (-randDir,randDir) $ _randGen w
|
||||
dir = a + baseDir
|
||||
spark = BulletPt
|
||||
{ _ptDraw = drawBul
|
||||
--{ _ptDraw = const mempty
|
||||
, _ptUpdate = mvBullet
|
||||
{ _ptUpdate = mvBullet
|
||||
, _btDrag = 0.9
|
||||
, _ptVel = rotateV dir (V2 5 0)
|
||||
, _ptColor = col
|
||||
|
||||
@@ -22,19 +22,11 @@ import LensHelp
|
||||
aTeslaArcAt :: Color -> [ArcStep] -> Particle
|
||||
aTeslaArcAt col thearc = PtTeslaArc
|
||||
{ _ptPoints = map (^. asPos) thearc
|
||||
, _ptDraw = drawTeslaArc
|
||||
, _ptUpdate = moveTeslaArc thearc
|
||||
, _ptTimer = 2
|
||||
, _ptColor = brightX 100 1.5 col
|
||||
}
|
||||
|
||||
drawTeslaArc :: Particle -> Picture
|
||||
drawTeslaArc pt = setLayer BloomNoZWrite $ pictures
|
||||
[ setDepth 20.5 $ color (brightX 2 1 $ _ptColor pt) $ thickLine 3 ps
|
||||
, setDepth 20 $ color (V4 0 0 0 0.5) $ thickLine 10 ps
|
||||
]
|
||||
where
|
||||
ps = _ptPoints pt
|
||||
moveTeslaArc :: [ArcStep]
|
||||
-> World
|
||||
-> Particle
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Render.ShapePicture
|
||||
( worldSPic
|
||||
) where
|
||||
import Dodge.Creature.Picture.Awareness
|
||||
import Dodge.Particle.Draw
|
||||
import Dodge.RadarBlip
|
||||
import Dodge.ShortShow
|
||||
import Dodge.Config.Data
|
||||
@@ -81,7 +82,7 @@ cullPoint cfig w p
|
||||
|
||||
extraPics :: Configuration -> World -> Picture
|
||||
extraPics cfig w = pictures (_decorations w)
|
||||
<> concatMapPic (dbArg _ptDraw) (_particles w)
|
||||
<> concatMapPic drawParticle (_particles w)
|
||||
<> concatMapPic drawBlip (_radarBlips w)
|
||||
<> concatMapPic (dbArg _bmDraw) (_positronBeams $ _beams w)
|
||||
<> concatMapPic (dbArg _bmDraw) (_electronBeams $ _beams w)
|
||||
|
||||
@@ -26,9 +26,8 @@ import System.Random
|
||||
|
||||
muzFlareAt :: Color -> Point3 -> Float -> World -> World
|
||||
muzFlareAt col tranv dir w = w & instantParticles .:~ PtMuzFlare
|
||||
{ _ptDraw = const $ setLayer BloomNoZWrite . translate3 tranv $ theShape
|
||||
, _ptUpdate = ptSimpleTime 2
|
||||
, _ptPoly =
|
||||
{ _ptUpdate = ptSimpleTime 2
|
||||
, _ptPoly = map (rotateV dir)
|
||||
[ V2 0 0
|
||||
, V2 a (-b)
|
||||
, V2 c d
|
||||
@@ -37,18 +36,11 @@ muzFlareAt col tranv dir w = w & instantParticles .:~ PtMuzFlare
|
||||
, _ptTran3 = tranv
|
||||
}
|
||||
where
|
||||
theShape = rotate dir . color col $ polygon
|
||||
[ V2 0 0
|
||||
, V2 a (-b)
|
||||
, V2 c d
|
||||
]
|
||||
(a:b:c:d:_) = randomRs (2,20) (_randGen w)
|
||||
|
||||
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
||||
flareCircleAt col alphax tranv = instantParticles .:~ PtCircFlare
|
||||
{ _ptDraw = const . setLayer BloomNoZWrite . translate3 tranv
|
||||
$ circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
|
||||
, _ptUpdate = ptSimpleTime 1
|
||||
{ _ptUpdate = ptSimpleTime 1
|
||||
, _ptColor = col
|
||||
, _ptAlpha = alphax
|
||||
, _ptTran3 = tranv
|
||||
|
||||
@@ -26,8 +26,7 @@ makeShockwaveAt
|
||||
-> World -- ^ Start world.
|
||||
-> World
|
||||
makeShockwaveAt is p rad dam push col = instantParticles .:~ Shockwave
|
||||
{ _ptDraw = drawShockwave
|
||||
, _ptUpdate = mvShockwave is
|
||||
{ _ptUpdate = mvShockwave is
|
||||
, _ptColor = col
|
||||
, _ptPos = p
|
||||
, _ptRad = rad
|
||||
@@ -88,8 +87,7 @@ inverseShockwaveAt
|
||||
-> World
|
||||
-> World
|
||||
inverseShockwaveAt p rad dam push = instantParticles .:~ Shockwave
|
||||
{ _ptDraw = drawInverseShockwave
|
||||
, _ptUpdate = moveInverseShockwave
|
||||
{ _ptUpdate = moveInverseShockwave
|
||||
, _ptColor = cyan
|
||||
, _ptPos = p
|
||||
, _ptRad = rad
|
||||
@@ -119,13 +117,3 @@ moveInverseShockwave w pt
|
||||
where
|
||||
cpos = _crPos cr
|
||||
|
||||
drawInverseShockwave :: Particle -> Picture
|
||||
drawInverseShockwave pt
|
||||
= setLayer BloomLayer $ setDepth 20 $ uncurryV translate p
|
||||
$ color cyan $ thickCircle rad thickness
|
||||
where
|
||||
p = _ptPos pt
|
||||
r = _ptRad pt
|
||||
t = _ptTimer pt
|
||||
rad = r - 0.1 * r * fromIntegral (10 - t)
|
||||
thickness = fromIntegral (10 - t) **2 * rad / 40
|
||||
|
||||
@@ -34,8 +34,7 @@ aFlameParticle
|
||||
-> Maybe Int -- ^ Creature id
|
||||
-> Particle
|
||||
aFlameParticle t pos vel maycid = PtFlame
|
||||
{ _ptDraw = drawFlame vel
|
||||
, _ptUpdate = moveFlame vel
|
||||
{ _ptUpdate = moveFlame vel
|
||||
, _ptVel = vel
|
||||
, _ptColor = red
|
||||
, _ptPos = pos
|
||||
@@ -46,36 +45,6 @@ aFlameParticle t pos vel maycid = PtFlame
|
||||
, _ptZ = 20
|
||||
, _ptOriginalVel = vel
|
||||
}
|
||||
drawFlame
|
||||
:: Point2 -- ^ Rotate direction
|
||||
-> Particle
|
||||
-> Picture
|
||||
drawFlame rotd pt = pictures
|
||||
[ glow
|
||||
, aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2 ) $ V4 2 (-1) (-1) 0.5
|
||||
, aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1 ) $ V4 1 0.5 0 2
|
||||
, aPic BloomLayer prot3 20 (V2 scaleChange 0.5) $ V4 1 1 1 1
|
||||
]
|
||||
where
|
||||
ep = _ptPos pt
|
||||
aPic :: Layer -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
|
||||
aPic lay offset depth (V2 scalex scaley) col
|
||||
= setLayer lay
|
||||
. setDepth depth
|
||||
. uncurryV translate (offset ep)
|
||||
. rotate (pi * 0.5 + argV rotd)
|
||||
. scale scalex scaley
|
||||
. color col
|
||||
$ circleSolid 5
|
||||
glow = setLayer BloomNoZWrite $ setDepth 0.3 $ uncurryV translate ep
|
||||
$ circleSolidCol (withAlpha 0 orange) (withAlpha 0.02 orange) 50
|
||||
time = _ptTimer pt
|
||||
scaleChange
|
||||
| time < 80 = 3
|
||||
| otherwise = 3 - (fromIntegral time - 80) * 0.2
|
||||
prot p' = p' +.+ rotateV (fromIntegral time) (V2 0 1)
|
||||
prot2 p' = p' +.+ rotateV (negate $ fromIntegral time) (V2 0 1)
|
||||
prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (V2 0 2)
|
||||
{- TODO: add generalised area damage particles/hiteffects. -}
|
||||
moveFlame :: Point2 -- ^ Rotation direction
|
||||
-> World
|
||||
@@ -116,8 +85,7 @@ moveFlame rotd w pt
|
||||
|
||||
concBall :: Point2 -> State g Particle
|
||||
concBall p = return Shockwave
|
||||
{ _ptDraw = drawShockwave
|
||||
, _ptUpdate = mvShockwave []
|
||||
{ _ptUpdate = mvShockwave []
|
||||
, _ptColor = white
|
||||
, _ptPos = p
|
||||
, _ptRad = 15
|
||||
@@ -130,8 +98,7 @@ concBall p = return Shockwave
|
||||
|
||||
aStaticBall :: Point2 -> State g Particle
|
||||
aStaticBall p = return PtStaticBall
|
||||
{ _ptDraw = drawStaticBall
|
||||
, _ptUpdate = moveStaticBall
|
||||
{ _ptUpdate = moveStaticBall
|
||||
, _ptVel = 0
|
||||
, _ptColor = blue
|
||||
, _ptPos = p
|
||||
@@ -154,8 +121,7 @@ makeFlamelet
|
||||
makeFlamelet (V2 x y) z vel maycid size time w = w
|
||||
& randGen .~ g
|
||||
& instantParticles .:~ PtIncBall
|
||||
{ _ptDraw = drawFlameletZ rot
|
||||
, _ptUpdate = moveFlamelet
|
||||
{ _ptUpdate = moveFlamelet
|
||||
, _ptVel = vel
|
||||
, _ptColor = red
|
||||
, _ptPos = V2 x y
|
||||
@@ -184,15 +150,6 @@ makeFlamelet (V2 x y) z vel maycid size time w = w
|
||||
-- sp = _ptPos pt
|
||||
-- ep = sp +.+ _ptVel pt
|
||||
|
||||
drawStaticBall
|
||||
:: Particle
|
||||
-> Picture
|
||||
drawStaticBall pt = setLayer BloomNoZWrite
|
||||
. setDepth (_ptZ pt + 20)
|
||||
. uncurryV translate (_ptPos pt)
|
||||
$ circleSolidCol (_ptColor pt) (withAlpha 0.5 white) (_ptWidth pt+5)
|
||||
|
||||
|
||||
moveStaticBall :: World -> Particle -> (World, Maybe Particle)
|
||||
moveStaticBall = moveFlamelet
|
||||
|
||||
@@ -257,8 +214,7 @@ incBall :: RandomGen g => Point2 -> State g Particle
|
||||
incBall p = do
|
||||
rot <- state $ randomR (0,3)
|
||||
return PtIncBall
|
||||
{ _ptDraw = drawFlameletZ rot
|
||||
, _ptUpdate = moveFlamelet
|
||||
{ _ptUpdate = moveFlamelet
|
||||
, _ptVel = 0
|
||||
, _ptColor = red
|
||||
, _ptPos = p
|
||||
@@ -269,50 +225,6 @@ incBall p = do
|
||||
, _ptZ = 20
|
||||
, _ptRot = rot
|
||||
}
|
||||
drawFlameletZ
|
||||
:: Float -- ^ Rotation
|
||||
-> Particle
|
||||
-> Picture
|
||||
drawFlameletZ rot pt = pictures
|
||||
[ setLayer BloomLayer pic
|
||||
, setLayer BloomNoZWrite piu
|
||||
, setLayer BloomNoZWrite pi2
|
||||
]
|
||||
where
|
||||
z = _ptZ pt
|
||||
sp = _ptPos pt
|
||||
vel = _ptVel pt
|
||||
ep = sp +.+ vel
|
||||
size = _ptWidth pt
|
||||
siz2 = size + 0.2
|
||||
time = _ptTimer pt
|
||||
piu = setDepth (z + 25)
|
||||
. uncurryV translate ep
|
||||
. color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
|
||||
(V4 2 0 0 1) (V4 2 0 0 0)
|
||||
)
|
||||
. rotate (negate (rot - 0.1 * fromIntegral time))
|
||||
. scale s1 s1
|
||||
$ polygon (rectNSWE siz2 (-siz2) (-siz2) siz2)
|
||||
pi2 = setDepth (z + 25)
|
||||
. uncurryV translate ep
|
||||
. color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
|
||||
(V4 2 1 0 0.5) (V4 0 0 0 0)
|
||||
)
|
||||
. rotate (negate (rot + 0.2 * fromIntegral time))
|
||||
. scale s2 s2
|
||||
$ polygon (rectNSWE siz2 (-siz2) (-siz2) siz2)
|
||||
pic = setDepth (z + 20)
|
||||
. uncurryV translate ep
|
||||
. color (mixColors (fromIntegral (max 0 (time-2))) (10-fromIntegral time)
|
||||
(V4 1 1 1 3) (V4 1 0 0 1)
|
||||
)
|
||||
. rotate (negate ( 0.1 * fromIntegral time + rot))
|
||||
. scale (0.5* sc) (0.5 *sc)
|
||||
$ polygon $ map toV2 [(-size,-size),(size,-size),(size,size),(-size,size)]
|
||||
sc = (*) 2 $ log $ 1 + fromIntegral time / 20
|
||||
s1 = (*) 2 $ log $ 2 + fromIntegral time / 40
|
||||
s2 = 0.5 * (sc + s1)
|
||||
|
||||
{- Update of a flamelet.
|
||||
Applies movement and attaches damage to nearby creatures. -}
|
||||
|
||||
Reference in New Issue
Block a user