- Edited
Hi. I'm a beginner in Godot but not a beginner in programming. I'll try to describe my concerns the best I can.
Through my learning exercises I'm trying to create simple 2D game on an hex grid. I got to the point where I can move player on the grid but now I'm trying to fill in grids with some interesting objects let it be different types of enemies, collectibles, action cells etc of which each having different capabilities: different rarities, durability, actions, etc.. I want objects allocation to be randomized.
For now I have a scene for a hex grid instantiating another scene which is a hex cell (Node2D). This hex cell has two children: Cell (AnimatedSprite) for cell animation and Unit (AnimatedSprite) for keeping object/item on the cell. For now Unit has bunch of animations each representing separate unit types (Enemy type 1, Action type 1, etc). I initially made it like this so I can simply randomize unit based on some enum type and based on that set the animation. But then it starts tricky when it comes to handling different types of unit's behaviors.
Can you help me identify how to approach to solve this?
I found some training videos on Godot's custom resources (.tres files connected with dedicated scripts inheriting from Resource) but yet don't feel it how to use them in my case. All the unit types seem to be a good candidates for class hierarchy but I guess at the end I'd need separate class for every each unit type so I could implement their behaviors. So here is questions: Is the custom resources good starting point? If I get it right they allow for storing data like all my units vs their abilities. Or load them from external file like JSON/XML/csv/..? In my example how shall I approach connecting custom resources to presented node tree? I wonder if there is some known Godot's way of doing things like that..