Implement simple flak and frag bullets

This commit is contained in:
2023-01-12 15:48:32 +00:00
parent 3508d9c266
commit d08b6c5727
14 changed files with 133 additions and 42 deletions
+21
View File
@@ -1,6 +1,7 @@
module Dodge.EnergyBall
( updateEnergyBall
, incBallAt
, makeFlashBall
, makeFlamelet
) where
@@ -70,6 +71,26 @@ incBallAt p w =
, _ebRot = rot
}
makeFlashBall :: Point2 -> World -> World
makeFlashBall p w =
w & cWorld . lWorld . energyBalls .:~ theincball
& randGen .~ g
where
(theincball, g) = runState thestate (_randGen w)
thestate = do
rot <- state $ randomR (0, 3)
return
EnergyBall
{ _ebVel = 0
, _ebColor = yellow
, _ebPos = p
, _ebWidth = 3
, _ebTimer = 20
, _ebEff = (LASERING, 1)
, _ebZ = 20
, _ebRot = rot
}
ebFlicker :: EnergyBall -> World -> World
ebFlicker pt
| _ebTimer pt `mod` 7 == 0 =