This commit is contained in:
2025-06-24 08:48:08 +01:00
parent 5537efe584
commit 366b998989
10 changed files with 25 additions and 28 deletions
+7 -7
View File
@@ -27,7 +27,7 @@ makeFlamelet p v s t w =
{ _ebVel = v
, _ebPos = p
, _ebTimer = t
, _ebEff = FlameletBall s a
, _ebType = FlameletBall s a
}
where
(a, g) = randomR (0, 3) $ _randGen w
@@ -36,18 +36,18 @@ updateEnergyBall :: World -> EnergyBall -> (World, Maybe EnergyBall)
updateEnergyBall w eb
| _ebTimer eb <= 0 = (w, Nothing)
| otherwise =
( ebEffect eb . ebFlicker eb $ ebDamage (_ebPos eb) (_ebEff eb) w
( ebEffect eb . ebFlicker eb $ ebDamage (_ebPos eb) (_ebType eb) w
, Just $ eb & ebTimer -~ 1 & ebPos .~ bp & ebVel .~ drag * bv
)
where
drag = case eb ^. ebEff of
drag = case eb ^. ebType of
ExplosiveBall -> 0.9
_ -> 0.85
p = eb ^. ebPos + eb ^. ebVel
(bp, bv) = fromMaybe (p, eb ^. ebVel) $ bouncePoint (const True) 0 (eb ^. ebPos) p w
ebEffect :: EnergyBall -> World -> World
ebEffect eb = case _ebEff eb of
ebEffect eb = case _ebType eb of
ElectricalBall i ->
soundContinue (EBSound i) (_ebPos eb) elecCrackleS (Just 2)
. randSparkExtraVel
@@ -68,7 +68,7 @@ energyBallAt ebt p =
{ _ebVel = 0
, _ebPos = p
, _ebTimer = 20
, _ebEff = ebt
, _ebType = ebt
}
makeMovingEB :: Point2 -> EnergyBallType -> Point2 -> World -> World
@@ -78,7 +78,7 @@ makeMovingEB v ebt p =
{ _ebVel = v
, _ebPos = p
, _ebTimer = 20
, _ebEff = ebt
, _ebType = ebt
}
makeFlashBall :: Point2 -> World -> World
@@ -92,7 +92,7 @@ ebFlicker pt
| otherwise = id
ebColor :: EnergyBall -> Color
ebColor eb = case eb ^. ebEff of
ebColor eb = case eb ^. ebType of
IncendiaryBall{} -> red
FlameletBall{} -> red
ElectricalBall{} -> cyan