Move flame into its own datatype
This commit is contained in:
@@ -5,7 +5,6 @@ import Picture
|
||||
|
||||
drawParticle :: Particle -> Picture
|
||||
drawParticle pt = case pt of
|
||||
PtFlame {} -> drawFlame pt
|
||||
Shockwave {} -> drawShockwave pt
|
||||
PtStaticBall {} -> drawStaticBall pt
|
||||
PtIncBall {} -> drawFlameletZ pt
|
||||
@@ -16,36 +15,6 @@ drawParticle pt = case pt of
|
||||
ShockLine {} -> drawSonicWave pt
|
||||
RadarCircleParticle {} -> drawPulse pt
|
||||
|
||||
drawFlame
|
||||
:: Particle
|
||||
-> Picture
|
||||
drawFlame 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
|
||||
rotd = _ptOriginalVel pt -- rotate direction
|
||||
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)
|
||||
|
||||
drawShockwave :: Particle -> Picture
|
||||
drawShockwave pt = setDepth 20
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
module Dodge.Particle.Flame where
|
||||
import Dodge.Data
|
||||
import Dodge.WorldEvent
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
import System.Random
|
||||
|
||||
makeFlame :: Point2 -> Point2 -> World -> World
|
||||
makeFlame pos vel w = w
|
||||
& instantParticles .:~ aFlameParticle t pos vel
|
||||
& randGen .~ g
|
||||
where
|
||||
(t,g) = randomR (99,101) (_randGen w)
|
||||
@@ -1,42 +0,0 @@
|
||||
module Dodge.Particle.TeslaArc
|
||||
( aTeslaArcAt
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Damage
|
||||
import Dodge.Spark
|
||||
import RandomHelp
|
||||
import Picture
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
aTeslaArcAt :: Color -> [ArcStep] -> Particle
|
||||
aTeslaArcAt col thearc = PtTeslaArc
|
||||
{ _ptPoints = map (^. asPos) thearc
|
||||
, _ptUpdate = moveTeslaArc thearc
|
||||
, _ptTimer = 2
|
||||
, _ptColor = brightX 100 1.5 col
|
||||
}
|
||||
|
||||
moveTeslaArc :: [ArcStep]
|
||||
-> World
|
||||
-> Particle
|
||||
-> (World,Maybe Particle)
|
||||
moveTeslaArc thearc w pt
|
||||
| _ptTimer pt == 2 = (makesparks $ foldr damthings w thearc, Just $ pt & ptTimer -~ 1)
|
||||
| _ptTimer pt < 1 = (w, Nothing)
|
||||
| otherwise = (w, Just $ pt & ptTimer -~ 1)
|
||||
where
|
||||
rcol = brightX 100 1.5 <$> takeOne [white,azure,blue,cyan]
|
||||
rdir = state (randomR (-0.7,0.7)) <&> (+ ld)
|
||||
rspeed = state (randomR (3,6))
|
||||
makeaspark = randSpark rspeed rcol rdir lp
|
||||
makesparks = makeaspark . makeaspark . makeaspark
|
||||
(lp,ld) = case last thearc of
|
||||
ArcStep lp' ld' Nothing -> (lp',ld')
|
||||
ArcStep lp' ld' (Just (Left cr)) -> (lp' -.- (_crRad cr + 1) *.* unitVectorAtAngle ld',ld'+pi)
|
||||
ArcStep lp' ld' (Just (Right _)) -> (lp' -.- 2 *.* unitVectorAtAngle ld',ld'+pi)
|
||||
damthings (ArcStep _ _ Nothing) = id
|
||||
damthings (ArcStep p dir (Just crwl)) = damageCrWall (thedamage p dir) crwl
|
||||
thedamage p dir = Damage ELECTRICAL 50 (p -.- q) p (p +.+ q) NoDamageEffect
|
||||
where
|
||||
q = 5 *.* unitVectorAtAngle dir
|
||||
Reference in New Issue
Block a user