Godot Version
4.3 (steam)
First off, I know it’s long but thank you for taking the time to read this.
I have a 2D game with a lever switch that uses 2 raycasts to tell if the player can turn it on or off depending on which side of the switch the player is standing. There is also a prompt system that displays ‘press enter’ over the players head when the player is colliding with the raycast.
I have it set up so I can add multiple switches as children to a door so all the switches need activating before the door opens.
All this works. The doors and switches work great and I can add as many children switches as i need. All the switches are duplicates of each other and share the same code.
The parent door code counts the number of children it has and compares it to a number. Each child switch adds or subs 1 to a variable inside the parent door depending on whether it is on or not.
When # of children equal the number of activations then the door opens. Pretty simple, scalable and it all works great.
The issue is not with the doors opening at all. It is with displaying the prompts.
When I have one parent door with one child switch the prompt displays properly.
If I add more children under the door only the bottom most switch in the list of children will display the prompt.
The other switches don’t sow the prompt at all.
The weird part is that the code still works for all the switches as far as activating the switch. They all use the same .gd file.
But the switches all work, they flip on and off properly and they successfully open and close the door.
The only thing that doesn’t work properly is that only one switch in the list of children shows the prompt in game.
It doesn’t feel like a code issue since I’ve tried removing all but one switch that previously didn’t show the prompt. When it’s the only switch left, or if I rearrange them so it is the bottom most switch then it displays the prompt.
I tried rearranging them and it seems to always be the bottom most switch in the list of children that shows the prompt properly. The others don’t show anything.
For testing purposes I’ve added print statements right before the function that display the prompts. The print statements work on all the switches but the prompt still only displays on one child, the bottom most one in the list. I just can’t figure out why.
It’s not game breaking but Just wondering if anyone has seen anything like this and maybe knows what the problem is.
Thanks for your time and any suggestions.