I’ve encountered an issue where my RigidBody2D
node does not emit signals somehow…
My node consists of a Sprite2D
, a CollisionShape2D
aswell as two Area2D’s that emit a signal, which fires a function, which they both use the same in a single script. This script is associated with the RigidBody2D
node.
Files
Here is my scene, and my script to help you identify the issue:
Scene
Bat.gd
Version
4.4.1 stable release
I see no code that calls emit
, or an entry in the scene that contains a signal connection. I would double check that the signal is connected to your function _on_direction_flip_body_entered
.
I dont know what to tell you but what ever you shared doesnt have any signals associated with it. And this image doesnt look the same as what you shared. The bat was a rigid body in the file you sent, but you have a Node in this picture.
You should look at the inspector instead of the scene tree, as this will tell you where your connection is going.
I guess if i look at your picture that node structure is all wrong. The bat rigid body (Base?) will not move the direction flip areas if they are not children of the Base node.
You could probably confirm that the areas are not moving if you turn on debug collision shapes in the debug menu.
I think i know whats happening
You have this Bat scene (ignore the red X, as you did not share the direction scene) with the direction areas but no signals.
Then you have your game scene with the Bat scene named Base.
With the same areas not as children, and wont move, connected externally in another scene to your Base-Bat scene.
You should fix your bat scene i think.
I had one last thought. If the external areas are meant to direct the bat to stay on the screen. Then you just need to make sure the area and bat collision bodies are on the same layers.