Hello everyone, I’m mostly seeking some feedback on the approach I’m taking for implementing a simple 2D door thing. Picked up Godot 4.2 a few weeks ago and started working on a simple 2D platformer game.
So, I have a level scene with all the level stuff. I built a sepparete scene for the door so I can reuse it easily on my level. Here’s the structure of the door (called ‘UniGate’ on my project):
The behaviour is super simple, when the player is within the Area2D of the entry, the player can make an activation action, and doing so it simply teleports the player to the global position of the Spawn node within the Exit, as a one-way teleport-kind-of thing. It works as intended already.
However, I’m doubting if it was a good idea to do it this way. When placing a door on my level, I have to enable ‘Editable children’ on it, so I can move the Exit node of a particular door wherever I want. But I’m not sure if I I’m happy with that, it certanly clobbers a bit the level scene if I start adding many doors on it. I included both entry and exit ‘objects’ within the same parent, and it seems that in a standard situation, these children should not be moveable when using the root door node on another scene, and be as a fixed pack of stuff.
A bit off-topic but relevant: the door I implemented here has a bit more stuff going on, it can be opened or closed, and it animates both entry and exit, plus there’s some other bools for control and stuff.
What do you think? Is using the ‘Editable children’ advisable in general?
I could rework this, as having a single door object as entry point, and have a node variable in the main script of it that I can set on the editor, to set an empty anywhere on the level scene. I could decorate around this empty with static props, or maybe I can make my main door object spawn a sprite at that location on runtime (I don’t know how to do that yet, but I’m sure it’s possible). But this way, it limits a bit future options (me thinks), and I end up with various empty nodes on the level scene that aren’t strongly connected.
I kinda liked the idea of having a ‘single’ thing that has 2 parts I can move around in the editor and not worry about connecting them, seemed organized to me, but I’m not sure if that is ‘correct’.
Leave me a thought if you like, want to hear how would you approach this specific construct.
Thanks