Time for action – adding the ShotManager class
Add a new class called
ShotManager
to the Asteroid Belt Assault project.Add declarations to the
ShotManager
class:Public Shots As List(Of Sprite) = New List(Of Sprite)() Private Shared _screenBounds As Rectangle Private Shared _texture As Texture2D Private Shared _initialFrame As Rectangle Private Shared _frameCount As Integer Private Shared _collisionRadius As Integer Private _shotSpeed As Single
Add a constructor to the the
ShotManager
class:Public Sub New ( texture As Texture2D, initialFrame As Rectangle, frameCount As Integer, collisionRadius As Integer, shotSpeed As Single, screenBounds As Rectangle) _Texture = texture _InitialFrame = initialFrame _FrameCount = frameCount _CollisionRadius = collisionRadius _shotSpeed = shotSpeed _screenBounds = screenBounds End Sub
What just happened?
ShotManager
maintains a list of fired shots. An enemy-fired shot will not hurt enemies, and a player-fired...