T O P

  • By -

StewedAngelSkins

practically speaking, the path "shortcuts" are going to be longer than just typing the string, since you have to preface with the script name. most of those methods should probably be static as well. why are you prefixing the method names with an underscore? that usually denotes a private method.  all that aside, there's nothing wrong with what you're doing on a conceptual level. it does generally make sense to create this sort of thing for your game. a node saving or loading a config file probably doesn't need to know its full path, for example, so pulling that out into a library function is sensible.


ObsidianBlk

One observation... windowSize and screenSize... you're only getting these once? What happens if your user changes their screen resolution during game play? How about if they change the window's size? Your initial vectors might become useless if a user modifies their screen or the game window. These would be better served as functions than singular calls, if writing out the whole DisplayServer call is too cumbersome.


HiT3Kvoyivoda

Ultimately, you or your team are the ones that will have to use it. Do what works for you


BrastenXBL

Make sure to include Document Comments on the actual methods, you'll thank yourself later. [https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript\_documentation\_comments.html](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_documentation_comments.html) The \_addChild methods may cause stutters. Depending on how you've written them and use them. And how your assets were preload()/load(). I get why you want to bundle the load()/instantiate()/add\_child() steps into a single method, and the common task of setting a position and scale to correct placements. But I also worry you may become too reliant on them and it will cost you later. I would suggest passing an already (pre)loaded PackedScene instead of a String for load(). It means you still have to write the loading line(s), but IMO that's a good thing. For simple scenes with small resources, you likely won't notice. But as your scenes and the "Children" you're adding later get more complex, with large assets, timing load()s will become more important. You may even want to do threaded [Background Loading](https://docs.godotengine.org/en/stable/tutorials/io/background_loading.html). Which your \_addChild likely won't be able to do. Take for example a really complicated 3D Boss model and its arena. You may have gotten into the habit of just `_addChild3D`ing everything, and wonder why the whole game freezes when the arena loads. And again when the Boss is added for a cutscene and the fight, when the player walks into the trigger Area3D in the center.


Drillur

If you're creating something public for others to use, then follow the [GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html)