Project code organization

Havok06Havok06 Posts: 1Member


Here is some context on my game so you understand what I'm trying to do.
Player starts on the edge of a level and needs to plan his way through it to avoid enemies. The player clicks on the map to make a path and then hit a button to start and the player character moves. Example.
Each tile on the path is an instance of a class called "Path_Node" and the "Player" class holds an array of Path_Nodes.

Then the player can use an item on them path to tell the character to use the item on the path. the item holds an "Action" instance which is then sent to the player and added to the "Path_Node".
Then there are as much classes inheriting from Action as there are different types of actions.




The issue I have is that if I create inner classes in the Object class, Player and Path_Node will never know what an Action is. I could create a .gd file for each Action but I don't like that for two reasons:
* I would need to import a list of files in all the scripts that need them
* I don't like to import things via path because if I move a file, then I need to update all my loads

What would be the most efficient way to organize my code in that case ? I'm kind of used to Unity where I would just create one file for every class and it would be accessible everywhere. Therefore I don't have enough experience with code management in Godot.

I will appreciate any help and thank you in advance.


Sign In or Register to comment.