Time for action – adjacent squares
Add the
findAdjacentNodes()
method to the Helper Methods region of thePathFinder
module:Private Function findAdjacentNodes( currentNode As PathNode, endNode As PathNode) As List(Of PathNode) Dim adjacentNodes As List(Of PathNode) = New List(Of PathNode)() Dim X As Integer = currentNode.GridX Dim Y As Integer = currentNode.GridY Dim upLeft As Boolean = True Dim upRight As Boolean = True Dim downLeft As Boolean = True Dim downRight As Boolean = True If ((X > 0) And (Not TileMap.IsWallTile(X - 1, Y))) THen adjacentNodes.Add(new PathNode( currentNode, endNode, New Vector2(X - 1, Y), CostStraight + currentNode.DirectCost)) Else upLeft = False downLeft = False End If If ((X < TileMap.MapWidth) And (Not TileMap.IsWallTile(X + 1, Y))) Then adjacentNodes.Add(new PathNode( currentNode...