Simplify energyBalls (no z component)

This commit is contained in:
2024-12-24 15:05:36 +00:00
parent c4b9142d0f
commit 957f233629
5 changed files with 14 additions and 18 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ data EnergyBall = EnergyBall
, _ebWidth :: Float
, _ebTimer :: Int
, _ebEff :: (DamageType, Int)
, _ebZ :: Float
-- , _ebZ :: Float
, _ebRot :: Float
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+3 -3
View File
@@ -38,7 +38,7 @@ makeFlamelet (V2 x y) z vel size time w =
, _ebWidth = size
, _ebTimer = time
, _ebEff = (FLAMING, 1)
, _ebZ = z
-- , _ebZ = z
, _ebRot = rot
}
where
@@ -72,7 +72,7 @@ incBallAt p w =
, _ebWidth = 3
, _ebTimer = 20
, _ebEff = (FLAMING, 1)
, _ebZ = 20
-- , _ebZ = 20
, _ebRot = rot
}
@@ -92,7 +92,7 @@ makeFlashBall p w =
, _ebWidth = 3
, _ebTimer = 20
, _ebEff = (LASERING, 1)
, _ebZ = 20
-- , _ebZ = 20
, _ebRot = rot
}
+9 -5
View File
@@ -1,4 +1,6 @@
module Dodge.EnergyBall.Draw where
module Dodge.EnergyBall.Draw (
drawEnergyBall,
) where
import Dodge.Data.Damage.Type
import Dodge.Data.EnergyBall
@@ -16,7 +18,8 @@ drawStaticBall ::
Picture
drawStaticBall pt =
setLayer BloomNoZWrite
. setDepth (_ebZ pt + 20)
. setDepth 20
-- . setDepth (_ebZ pt + 20)
. uncurryV translate (_ebPos pt)
$ circleSolidCol (_ebColor pt) (withAlpha 0.5 white) (_ebWidth pt + 5)
@@ -28,7 +31,8 @@ drawFlamelet pt =
, setLayer BloomNoZWrite pi2
]
where
z = _ebZ pt
z = 20
-- z = _ebZ pt
sp = _ebPos pt
vel = _ebVel pt
ep = sp +.+ vel
@@ -47,7 +51,7 @@ drawFlamelet pt =
)
. rotate (negate (rot - 0.1 * fromIntegral time))
. scale s1 s1
. polygon
. polygon
$ reverse (rectNSWE siz2 (- siz2) (- siz2) siz2)
pi2 =
setDepth (z + 25)
@@ -61,7 +65,7 @@ drawFlamelet pt =
)
. rotate (negate (rot + 0.2 * fromIntegral time))
. scale s2 s2
. polygon
. polygon
. reverse
$ rectNSWE siz2 (- siz2) (- siz2) siz2
pic =
-8
View File
@@ -10,7 +10,6 @@ module Dodge.WorldEvent.Explosion (
import Control.Monad
import Data.List
import Dodge.Base.Collide
import Dodge.Data.World
import Dodge.EnergyBall
import Dodge.Flame
@@ -88,17 +87,10 @@ makeExplosionAt p vel w =
let (a, b, c) = unzip3 $ map fromV3 fPs''
in (zipWith V2 a b, c)
--fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs'
fPs = map (pushAgainstWalls . (+.+) p) fPs'
inversePushOut v = (15 - magV v) * 0.01 *.* v
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w
mF q z v size time = makeFlamelet (q - vel) z (v + vel) size time
--newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times
newFs = zipWith4 (mF p) zs (zipWith ((+) . xyV3) fPs'' (fmap (3 *.*) fVs')) sizes times
addFlames w' = foldl' (flip ($)) w' newFs
--pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q wls
--pushAgainstWalls q = maybe q fst $ reflectPointWalls p q wls
pushAgainstWalls q = maybe q fst $ bouncePoint (const True) 1 p q w
-- wls = wallsNearPoint p w
+1 -1
View File
@@ -48,7 +48,7 @@ aStaticBall p =
, _ebWidth = 3
, _ebTimer = 20
, _ebEff = (ELECTRICAL, 10)
, _ebZ = 20
-- , _ebZ = 20
, _ebRot = 0
}