My player shoots off the screen

Godot Version



I have developed a 2D game where everything works perfectly until at some (random) moment, when my player collides with an enemy, it is thrown to the left of the screen and does not spawn again. I don’t have any error messages through the console, I have reviewed the programming logic and I don’t see any problem, given that there are times when the error appears and there are times when the error does not occur for long periods. I don’t know if this has happened to anyone or if it’s unprecedented…

I check this problem and i know the error appear when a function of detecting the leader of the player’s enemies area is congested. My player appeared in a place where when he was killed he appeared where there was another enemy and apparently according to the log that function was saturated. The solution is for him to respawn in a safe place where he won’t be killed repeatedly. I don’t know if this is a bug or not, but this is the solution I found in my case. In any case, I listen to opinions about this error. Thank you!!