Time for action – creating the ScoreZoom class
Add a new class file called
ScoreZoom.vb
to the Flood Control project.Add the following declarations to the
ScoreZoom
class:Public Text As string Public DrawColor As Color Private displayCounter As Integer Private maxDisplayCount As Integer = 30 Private _scale As Single = 0.4 Private lastScaleAmount As Single = 0.0 Private scaleAmount As Single = 0.4
Add the
Scale
read-only property to theScoreZoom
class:Public ReadOnly Property Scale as Single Get Return (scaleAmount * displayCounter) End Get End Property
Add a
Boolean
property to indicate when theScoreZoom
has finished displaying:Public ReadOnly Property IsCompleted as Boolean Get Return (displayCounter > maxDisplayCount) End Get End Property
Create a constructor for the
ScoreZoom
class:Public Sub New(displayText as String, fontColor as Color) Text = displayText DrawColor = fontColor displayCounter = 0 End Sub
Add an
Update()
method to theScoreZoom...