Time for action – the PathNode class
Add a new class called
PathNode
to the Robot Rampage project.#Region "Declarations" Public ParentNode As PathNode Public EndNode As PathNode Public TotalCost As Single Public DirectCost As Single Private _gridLocation As Vector2 #End Region
Add properties to the
PathNode
class:#Region "Properties" Public Property GridLocation As Vector2 Get Return _gridLocation End Get Set(ByVal Value as Vector2) _gridLocation = new Vector2( CSng(MathHelper.Clamp(value.X,0F,CSng(TileMap. MapWidth))), CSng(MathHelper.Clamp(value.Y,0F,CSng(TileMap. MapHeight)))) End Set End Property Public ReadOnly Property GridX As Integer Get Return CInt(Int(GridLocation.X)) End Get End Property Public ReadOnly Property GridY As Integer Get Return CInt(Int(GridLocation.Y)) End Get End Property #End Region
Add a constructor to the
PathNode
class:#Region "Constructor...