Time for action – building explosions
Add the
AddExplosion()
method to the Public Methods region of theEffectsManager
module:Public Sub AddExplosion( location As Vector2, momentum As Vector2, minPointCount As Integer, maxPointCount As Integer, minPieceCount As Integer, maxPieceCount As Integer, pieceSpeedScale As Single, duration As Integer, initialColor As Color, finalColor As Color) Dim explosionMaxSpeed As Single = 30 Dim pointSpeedMin As Integer = CInt(pieceSpeedScale * 2) Dim pointSpeedMax As Integer = CInt(pieceSpeedScale * 3) Dim pieceLocation As Vector2 = location - New Vector2(CSng(_expFrames(0).Width) / 2, CSng(_expFrames(0).Height) / 2) Dim pieces As Integer pieces = _rand.Next(minPieceCount, maxPieceCount + 1) For x As Integer = 1 To pieces _effects.Add(new Particle( pieceLocation, _texture, _expFrames(_rand.Next(0, _expFrames.Count)), ...