Work on energy balls

This commit is contained in:
2025-06-08 23:31:44 +01:00
parent 7e8eaaa34e
commit 3dce133f30
5 changed files with 144 additions and 95 deletions
+6 -7
View File
@@ -20,6 +20,8 @@ import System.Random
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
updateBullet w bu
| magV (_buVel bu) < 10
, BulBall _ <- _buPayload bu = (useBulletPayload bu (_buPos bu) w, Nothing)
| magV (_buVel bu) < 1 = (useBulletPayload bu (_buPos bu) w, Nothing)
-- have to be slightly carefull not to accelerate bullets using magnets
| otherwise = second (Just . updateBulVel) . hitEffFromBul w $ applyMagnetsToBul bu w
@@ -114,11 +116,10 @@ useBulletPayload bu = case _buPayload bu of
BulFlak -> makeFlak bu
BulFrag -> makeFragBullets
BulGas -> (`makeGasCloud` V2 0 0)
-- BulBall FlamingBall -> incBallAt
BulBall ExplosiveBall -> \p -> cWorld . lWorld . shockwaves .:~ concBall p
BulBall ElectricalBall -> makeStaticBall
BulBall FlashBall -> makeFlashBall
BulBall (FlameletBall x _) -> \p -> makeFlamelet p 0 x 10
BulBall ElectricalBall -> makeMovingEB (_buVel bu) ElectricalBall
BulBall FlashBall -> makeMovingEB (_buVel bu) FlashBall
BulBall (FlameletBall x r) -> makeMovingEB (_buVel bu) (FlameletBall x r)
makeFragBullets :: Point2 -> World -> World
makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
@@ -134,7 +135,6 @@ makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
& buPos .~ p
& buOldPos .~ p
& buWidth .~ 1
-- & buDamages .~ [Damage PIERCING 5 0 0 0 $ PushBackDamage 2]
makeFlak :: Bullet -> Point2 -> World -> World
makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
@@ -144,7 +144,6 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
f x = bu & buVel %~ g x
& buPayload .~ BulPlain 25
& buWidth .~ 0.5
-- & buDamages .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2]
g x v = v +.+ x *.* normalizeV (vNormal v)
hitEffFromBul :: World -> Bullet -> (World, Bullet)
@@ -196,7 +195,7 @@ moveBullet pt = pt & buPos +~ _buVel pt & buOldPos .~ _buPos pt
stopBulletAt :: Point2 -> Bullet -> Bullet
stopBulletAt hitp pt =
pt
& buPos .~ hitp
& buPos .~ hitp + squashNormalizeV (_buPos pt - hitp)
& buOldPos .~ _buPos pt
& buVel .~ 0