Improve static bullets

This commit is contained in:
2022-07-19 13:15:13 +01:00
parent 54ba0fbedc
commit 0a7922ec5e
19 changed files with 287 additions and 134 deletions
+52
View File
@@ -0,0 +1,52 @@
module Dodge.EnergyBall.Draw where
import Dodge.Data
import Geometry
import Picture
drawEnergyBall :: EnergyBall -> Picture
drawEnergyBall = drawFlameletEB
drawFlameletEB :: EnergyBall -> Picture
drawFlameletEB pt = pictures
[ setLayer BloomLayer pic
, setLayer BloomNoZWrite piu
, setLayer BloomNoZWrite pi2
]
where
z = _ebZ pt
sp = _ebPos pt
vel = _ebVel pt
ep = sp +.+ vel
size = _ebWidth pt
siz2 = size + 0.2
time = _ebTimer 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)
rot = _ebRot pt