Time for action – the EffectsManager module
Add a new module called
EffectsManager
to the Robot Rampage project.Add declarations to the
EffectsManager
module:#Region "Declarations" Private _effects As List(Of Particle) = New List(Of Particle) Private _rand As Random = New Random() Private _texture As Texture2D Private _particleFrame As Rectangle = New Rectangle(0, 288, 2, 2) Private _expFrames As List(Of Rectangle) = New List(Of Rectangle) #End Region
Add an
Initialize()
method to theEffectsManager
module:#Region "Initialization" Public Sub Initialize( texture As Texture2D, particleFrame As Rectangle, explosionFrame As Rectangle, explosionFrameCount As Integer) _texture = texture _particleFrame = particleFrame _expFrames.Clear() _expFrames.Add(explosionFrame) For X as Integer = 1 to explosionFrameCount - 1 explosionFrame.Offset(explosionFrame.Width, 0) _expFrames.Add(explosionFrame) Next End Sub #End Region
Add the
RandomDirection(...