Time for action – building the Player module
Add a new module called
Player
to the Robot Rampage project.Add declarations to the Player module:
#Region "Declarations" Public BaseSprite As Sprite Public TurretSprite As Sprite #End Region
Add the
Initialize()
method to thePlayer
module:#Region "Initialization" Public Sub Initialize( texture As Texture2D, baseInitialFrame As Rectangle, baseFrameCount As Integer, turretInitialFrame As Rectangle, turretFrameCount As Integer, worldLocation As Vector2) Dim frameWidth As Integer = baseInitialFrame.Width Dim frameHeight As Integer = baseInitialFrame.Height BaseSprite = new Sprite( worldLocation, texture, baseInitialFrame, Vector2.Zero) BaseSprite.BoundingXPadding = 4 BaseSprite.BoundingYPadding = 4 BaseSprite.AnimateWhenStopped = False For x As Integer = 1 To baseFrameCount - 1 BaseSprite.AddFrame( new Rectangle( baseInitialFrame.X + (frameHeight...