Godot Version
4.3.stable.official
Question
I am currently testing out ideas for my game and one thing I’m focusing on right now is combat. I’ve made a simple example where the player runs around a graveyard fighting skeletons. The intent here is to play around with pathfinding and attacking and so on.
My current project looks like this.
foes
is a Node2D which is intended to do two things: (1) contain the script (astar.gd
) necessary for the astar pathfinding, and (2) organize all the enemies in the game.
Skelly
is intended to be a scene representing a basic enemy type. It only handles movement as well as scanning nearby tiles for the player in order to initiate an attack.
The intent is that foes
can instantiate any number of enemies (in addition to the above purpose) and all the instantiated scenes will handle their own actions (moving, attacking, etc) but uses the common navigation map contained in foes
. A common navigation map would prevent enemies from stacking, as well as (I think) open up opportunities for other attacks. At the very least, having each enemy have it’s own navigation grid seems wasteful.
My issue is that I don’t know the code needed for skelly.gd
(or any other instantiated scene) to look at astar.gd
and go, “Oh, there’s the map I need to use to compute my path with.” I’m not even sure what key terms to use to look it up in documentation.
Any thoughts or help is greatly appreciated!