Godot Version
V4.3, C#
Question
Hello everyone,
I,m new to godot an gamedesign in general, I do have some experience with coding (in C#) so I am making my scripts in C#.
To summarise my question: I am confused on how some interactions and boundries between scenes work.
I am following the tutorial brackeys made (https://youtu.be/LOhfqjmasi0) while researching and adding things I think would be interesting. This has been going fine so far but now I am getting stuck on the interraction between a player and a killbox.
It is confusing to me what tasks what components should take on. So the hitbox has a on_Body_Entered signal which then should let the player die and the game reset. Why does the hitbox perform actions on the player and overall game scene. I have alway learned that different scenes or classes in my case only edit code from thier children and not preform actions on other scenes. so in this case it is on the player code to let the player die (for example taking away movement). and the overall game scene to reset Instead of the hitbox doing all these things.
I had a look around on the forums/ videos on the topic. I also had a conversation with GPT about this topic he wasnt very relieable but he gave me a couple of solutions:
- Giving the player the hitbox detection so it does the right actions depending on the bodytype encountered
- Making a global signal so scenes can hook onto this signal to do thier thing if the signal is sent out. (i dont know how to do this)
- Doing it like the tutorial and check for a body of type player and then make a public function on the player the hitbox can access
- Another better option.
What solution is the best in terms of scalabillty, stabillity and just good practice.
I do realise there isn’t any solid rules unlike other fields but mabye there are some good tips.