Godot Version
4.4.1 Stable
Questions
I apologize if this has been asked somewhere else (I couldn’t find it) I’ve been working on a pretty complicated project and I’m new to Godot. I have a lot of experience in other engines/languages and I am writing this in GDScript. I’m trying to determine if there is some function or better way of doing what I’m doing or something obvious I am not using.
The project has a modular UI that controls other modular UI elements and also the stage as well as how NPCs react to it.
- I am constantly using for loops to get/set things from my manager objects. Am I missing a better way or is just how it is? See below:
for items in get_tree.get_nodes_in_group("StageObjects"):
if items.name=="Door":
items.door_is_open = true
I use a lot of this because game objects access managers, and those managers handle the logic. Is this normal? I’m used to the Gamemaker way which allows you to bulk access by doing something like: Door.door_is_open = true
-
I am constantly using “Holders” which are Node2Ds and then adding children to them. I do this to make sure certain things are on top of other things. In my levels, I now have a “PlayerHolder” because I want to have a background and a foreground.
It works, and it’s fine, but is there some other way I should be doing it? I’ve considered making an insert_child(node1,node2) function but that seems to be more work than just using these holders.
-
I think the game UI is a bit claustrophobic. The game window is 1366x768 and looks good. If I expand the window size to 1920x1080 I don’t want the 1366x768 to stretch or change at all. I just want to add a border on all sides. I’ve naturally tried to change the window size, and the stretch settings, but I don’t really see anything like “Set Main Node2D to center”. So I’m trying to get some ideas on how to resolve this. This would be a lot easier if I wasn’t using pixel art. Is there some setting or anything I’m missing that could help?