Time for action – summoning the zombies
Add a new class called
Enemy
to the Gemstone Hunter project.Add the following
Imports
directive to the top of theEnemy
class file:Imports Tile_Engine
Add an
Inherits
line to derive theEnemy
class fromGameObject
:Public Class Enemy Inherits GameObject
Add declarations for the
Enemy
class:#Region "Declarations" Private _fallSpeed As Vector2 = New Vector2(0, 20) Private _walkSpeed As Single = 60 Private _facingLeft As Boolean = True #End Region
Add a property to the
Enemy
class:#Region "Properties" Public Property Dead As Boolean #End Region
Add a constructor for the
Enemy
class:#Region "Constructor" Public Sub New( content As ContentManager, cellX As Integer, cellY As Integer) _animations.Add("idle", New AnimationStrip( content.Load(Of Texture2D)( "Textures\Sprites\MonsterC\Idle"), 48, "idle")) _animations("idle").LoopAnimation = True _animations.Add("run", ...