Godot Version
4.5.1 stable
Question
Hello, thanks in advance if you reading this! The last few days i been trying to get GameDev more seriously and i have been doing a free course by Clear Code, to get things right since i felt like falling into “tutorial hell” starting completly on my own, having to search the most basic things to get something done and not having that much return in terms of learning. The course helped me a lot to get the start on basics and i trying to improve the last game made during it.
The idea is this 3D “bullet hell” game, where you have a spaceship and objects gonna fly in your direction. Expanding the idea to practice coding, i decided to add “classes” with different meshs, bullet cooldown and speed, and thinking about it passed to my mind the idea of having different player scenes, each with the same main node name with @export in the variables to change those values.
In the main menu the player would choose a ship, and it would store in a Global variable the node, until it, is fine, works well the system, but i have 3 signals (✦ For the player shooting to send it’s position to create the bullet ✦ For the HUD to show health ✦ for the Levels’ node to manage what happens when player dies) in the scene than are linked to the player, and since it will be instantiated, i can’t use the editor to connect, so i used GDScript, but i’m running on the problem that the nodes throw an error since when “_ready” of the other scripts are read, the player isn’t loaded yet, since as far as i understand the “bases” nodes of the scene are loaded at the same time so then you wouldn’t have it’s children.
I tried using “_init” on the Level’s node to instantiate the player, since it occurs earlier than “_ready” but i bump into a error since the node where the player you be instantiated ins’t loaded yet, and trying to do the same in the Level’s node throw the “Breakpoint” error.
One way around i found was storing a number on Global as the selected type of Ship, in the Main scene i would have the Player node (with the hitbox and meshes of the 3 types of Ships), since doing that way the signals would connect without problem, and in the “_ready” of the player node it would check the number and free() the unselected meshs and collisions, and assign the correct values to speed, cooldown and health. Works, but appears to be too much “brute force” and manual in case i try to reutilise this system for a future project!
Knowing that, what would be recommend to do since the signals not connecting are the problem? (or there are other?) I’m really trying to understend the basics and get best practices, even knowing than i will bump in a lot of bad ones since i’m only starting. Thanks for your time reading this!