Has anyone else experienced this? I have enemies that move and collide with objects. When they collide with a player character a signal is sent to kill that player - fairly standard. Naturally, the player and the enemies are their own objects. I also have functionality that allows the player to end a level if they're holding a key and they reach a door. The key and door are likewise their own objects. The door is an Area2D while the enemies, player, and key are kinematic bodies. The door has a single function:
func on_Area2D_body_entered(body):
if has_key:
send signals to end the level.
Very straightforward.
I have my enemies moving on the level. They have code in physics process that looks like this:
collision = move_and_collide(vector)
if collission.collider.name = "player":
send signal that kills player.
Again straightforward.
So, imagine my surprise when I have a key and I run into an enemy, and my player dies, the level resets, but all of the signals that end the level have triggered and I have a congrats message popped up, my timer is stopped, and my player is disabled.
Running into an enemy with the key triggered the on_Area2D_body_entered(body) function. I know this because I tested it many times and added print statements just to make sure.
I fixed my issue with a simple position check, but how obnoxious that the kinematic body collision detection is somehow linked to the Area2D collision detection. Has anyone else experienced anything like this?