Time for action – building the AnimationStrip class
In the Gemstone Hunter project, add a new class called
AnimationStrip
.Add declarations to the
AnimationStrip
class:#Region "Declarations" Private _frameTimer As Single = 0 Private _currentFrame As Integer Private _finishedPlaying As Boolean = False #End Region
Add properties to the
AnimationStrip
class:#Region "Properties" Public Property FrameWidth As Integer Public Property FrameHeight As Integer Public Property Texture As Texture2D Public Property Name As String Public Property NextAnimation As String Public Property LoopAnimation As Boolean = True Public Property FrameLength as Single = 0.05 Public ReadOnly Property FinishedPlaying As Boolean Get Return _finishedPlaying End Get End Property Public ReadOnly Property FrameCount As Integer Get Return CInt(Int(texture.Width / frameWidth)) End Get End Property Public ReadOnly Property FrameRectangle As Rectangle Get Return New Rectangle( ...