Time for action – creating the Player class
In the Gemstone Hunter project, add a new class called
Player
.Add the following
Imports
directive to the top of thePlayer
class file:Imports Tile_Engine
Modify the declaration of the
Player
class to inherit from theGameObject
class:Public Class Player Inherits GameObject
Add declarations to the
Player
class:#Region "Declarations" Private _fallSpeed As Vector2 = new Vector2(0, 20) Private _moveScale As Single = 180 Private _dead As Boolean = false #End Region
Add the
Dead
property to thePlayer
class:#Region "Properties"Public ReadOnly Property Dead As Boolean Get Return _dead End Get End Property #End Region
Create a constructor for the
Player
class:#Region "Constructor" Public Sub New(content As ContentManager) _animations.Add("idle", new AnimationStrip( content.Load(Of Texture2D)("Textures\Sprites\Player\Idle"), 48, "idle")) _animations("idle").LoopAnimation = True _animations.Add...