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 , _ebWidth :: Float
, _ebTimer :: Int , _ebTimer :: Int
, _ebEff :: (DamageType, Int) , _ebEff :: (DamageType, Int)
, _ebZ :: Float -- , _ebZ :: Float
, _ebRot :: Float , _ebRot :: Float
} }
deriving (Eq, Ord, Show, Read) --Generic, Flat) 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 , _ebWidth = size
, _ebTimer = time , _ebTimer = time
, _ebEff = (FLAMING, 1) , _ebEff = (FLAMING, 1)
, _ebZ = z -- , _ebZ = z
, _ebRot = rot , _ebRot = rot
} }
where where
@@ -72,7 +72,7 @@ incBallAt p w =
, _ebWidth = 3 , _ebWidth = 3
, _ebTimer = 20 , _ebTimer = 20
, _ebEff = (FLAMING, 1) , _ebEff = (FLAMING, 1)
, _ebZ = 20 -- , _ebZ = 20
, _ebRot = rot , _ebRot = rot
} }
@@ -92,7 +92,7 @@ makeFlashBall p w =
, _ebWidth = 3 , _ebWidth = 3
, _ebTimer = 20 , _ebTimer = 20
, _ebEff = (LASERING, 1) , _ebEff = (LASERING, 1)
, _ebZ = 20 -- , _ebZ = 20
, _ebRot = rot , _ebRot = rot
} }
+7 -3
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.Damage.Type
import Dodge.Data.EnergyBall import Dodge.Data.EnergyBall
@@ -16,7 +18,8 @@ drawStaticBall ::
Picture Picture
drawStaticBall pt = drawStaticBall pt =
setLayer BloomNoZWrite setLayer BloomNoZWrite
. setDepth (_ebZ pt + 20) . setDepth 20
-- . setDepth (_ebZ pt + 20)
. uncurryV translate (_ebPos pt) . uncurryV translate (_ebPos pt)
$ circleSolidCol (_ebColor pt) (withAlpha 0.5 white) (_ebWidth pt + 5) $ circleSolidCol (_ebColor pt) (withAlpha 0.5 white) (_ebWidth pt + 5)
@@ -28,7 +31,8 @@ drawFlamelet pt =
, setLayer BloomNoZWrite pi2 , setLayer BloomNoZWrite pi2
] ]
where where
z = _ebZ pt z = 20
-- z = _ebZ pt
sp = _ebPos pt sp = _ebPos pt
vel = _ebVel pt vel = _ebVel pt
ep = sp +.+ vel ep = sp +.+ vel
-8
View File
@@ -10,7 +10,6 @@ module Dodge.WorldEvent.Explosion (
import Control.Monad import Control.Monad
import Data.List import Data.List
import Dodge.Base.Collide
import Dodge.Data.World import Dodge.Data.World
import Dodge.EnergyBall import Dodge.EnergyBall
import Dodge.Flame import Dodge.Flame
@@ -88,17 +87,10 @@ makeExplosionAt p vel w =
let (a, b, c) = unzip3 $ map fromV3 fPs'' let (a, b, c) = unzip3 $ map fromV3 fPs''
in (zipWith V2 a b, c) in (zipWith V2 a b, c)
--fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs' --fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs'
fPs = map (pushAgainstWalls . (+.+) p) fPs'
inversePushOut v = (15 - magV v) * 0.01 *.* v inversePushOut v = (15 - magV v) * 0.01 *.* v
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs' fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2, 9) $ _randGen w sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w times = randomRs (15, 20) $ _randGen w
mF q z v size time = makeFlamelet (q - vel) z (v + vel) size time 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 newFs = zipWith4 (mF p) zs (zipWith ((+) . xyV3) fPs'' (fmap (3 *.*) fVs')) sizes times
addFlames w' = foldl' (flip ($)) w' newFs 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 , _ebWidth = 3
, _ebTimer = 20 , _ebTimer = 20
, _ebEff = (ELECTRICAL, 10) , _ebEff = (ELECTRICAL, 10)
, _ebZ = 20 -- , _ebZ = 20
, _ebRot = 0 , _ebRot = 0
} }