Hi, just starting out, and I'm trying to figure out how to structure my nodes/scripts/scenes logically... Basically, I'm trying to make a game using a split screen (two viewports), which will be highly interactive. Left will have a world with player & entities, and the right a sort of 'action' board which will be highly dependent on everything happening on the left side...
My issue is that when I'm trying to initialize the action board, then I need a bunch of stuff; player characters, stats, items, enemies, enemy stats, enemy items, world state (ex; location forest, road, city, etc.), etc. So there's just way too many things to pass to initialization methods...
And yeah this just doesn't seem to fit very well with the nodes/scene structure... Well... It just popped in my mind that I could just pass my entire Master Node to the action board and so could have access to everything!
Right now I have:
MainScene
|--ViewPortContainer
|--- ViewPort for [MasterWorld Scene]
|--- ViewPort for [ActionBoard Scene]
MasterWorld Scene/node
|-- World
|----Player
|----Enemies
ActionBoard Scene/node
|-- Board1
|-- Board2
Hmmm... So yeah now this seems kind of obvious... Pass the entire MasterWorld node to the ActionBoard, and make the MasterWorld script a sort of getter & function caller for all its sub elements for the Board Script? The 'world' will also influence the board, so... It will also need to call some functions. It'll also need to make changes; player HP, location, call player attack, kill enemy, etc., So basically... Just pass the entire Board to the World, and the World to the Board? Or is there some better or more practical way of doing things?
Thanks!!