Time for action – updating and drawing the player's ship
Add the
imposeMovementLimits()
helper method to thePlayerManager
class:Private Sub imposeMovementLimits() Dim location as Vector2 = playerSprite.Location If location.X < playerAreaLimit.X Then location.X = playerAreaLimit.X End If If location.X > (playerAreaLimit.Right - playerSprite.Source.Width) Then location.X = (playerAreaLimit.Right - playerSprite.Source.Width) End If If location.Y < playerAreaLimit.Y location.Y = playerAreaLimit.Y End If If location.Y > (playerAreaLimit.Bottom - playerSprite.Source.Height) Then location.Y = (playerAreaLimit.Bottom - playerSprite.Source.Height) End If playerSprite.Location = location End Sub
Add the
Update()
method to thePlayerManager
class:Public Sub Update(gameTime As GameTime) PlayerShotManager.Update(gameTime) If Not Destroyed Then playerSprite...