I followed a tutorial from GDQuest regarding path description from Navigation 2D node.
I declared a variable path as a PoolVector2Array as given in the tutorial.
I also declared an onready variable character which is supposed to move along
a defined Navigation tilemap. This was also as per the tutorial guideline.
I then assigned the path of the character through this assignment:
var new_path = nav_2d.get_simple_path(character.global_position, event.global_position)
****
character.path = new_path
nav_2d is the refers to the node Navigation2D. I get the following error, however.
*Invalid set index 'path' (on base: 'Sprite') with value of type 'PoolVector2Array'.*
The diversions from the tutorial are these:
-in the tutorial only the unhandledinput(event: InputEvent) -> void is in the script that extends a Node. The _process function and the user defined movement function is in the script that extends a Sprite
-in my code, I have inserted the _process function , the user defined movement function, and the unhandled_input(event: InputEvent) -> void function in a script that extends a Node.
Are the diversions from the script the reason that I am getting the error? I have followed the tutorial code exactly in a test project and it is working fine there.
The reason I have deviated from the tutorial code is that I want more than one character to move along Navigation2D paths. The way I want to achieve this is through two touchscreen buttons where each makes a boolean true and then a particular character is made to move along the Navigation path.
Please help.