Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | felipe.canever.f |
Hello, everyone!
In my project, when the game runs, I spawn a number of Area2D
s, which I call “food”, randomly around the scene from inside _ready
. Inside the same function, I also spawn a number of KinematicBody2D
s, which I call “creatures” and which can move around and gather that food. Both are spawned by instantiating their respective scenes. The creatures “eat” when they come in contact with a piece of food, i.e., when a piece of food emits its body_entered
signal connected to that creature. The problem is that, if a creature and a piece of food happen to spawn overlapping each other, the piece of food doesn’t emit body_entered
, and the creature gets stuck trying to eat it (it has AI and can move around in search for the nearest piece of food).
Therefore my question is how can I make sure the piece of food emits the signal if it spawns overlapping a creature? Is that a limitation of the physics engine or there is a way I can fix it?
Thanks in advance!