Time for action – the Particle class
Add a new class called
Particle
to the Robot Rampage project.Update the class declaration for the
Particle
class to derive it from theSprite
class by adding anInherits
line below the class declaration:Inherits Sprite
Add declarations to the Particle class:
#Region "Declarations" Private _acceleration As Vector2 Private _maxSpeed As Single Private _initialDuration As Integer Private _remainingDuration As Integer Private _initialColor As Color Private _finalColor As Color #End Region
Add properties to the
Particle
class:#Region "Properties" Public ReadOnly Property ElapsedDuration As Integer Get Return _initialDuration - _remainingDuration End Get End Property Public ReadOnly Property DurationProgress As Single Get Return CSng(ElapsedDuration) / CSng(_initialDuration) End Get End Property Public ReadOnly Property IsActive As Boolean Get Return (_remainingDuration > 0) End Get End Property #End Region
Add...