Hello,
I was wondering what’s the best way to keep track of the Player object (ex. stats, points , armor , maybe meshes)?
I was thinking that it should be ok to have a Global Autoload class that does that maybe include there Player 3d Model with all the changes that occur during game . (using export packed scene or something)
Is this ok or there are other best practice ideas ?
Thanks,
Hi!
Normally, when I want to keep track of some stats, like the score, I use a setter function that emits a signal. This way, when the score is updated, it propagates to the rest of the game. If there’s any node that relies on this event, such as the HUD displaying the score, it gets updated automatically.
You might consider using a singleton to persist these stats, but I’m not sure if that’s the correct approach. If your player dies, it will retain the last stats that were updated. If that’s not supposed to happen, this might not be the best method.
Can i have PackedScenes in this Singleton class?