I'm trying to create an enemy with a Area2D node. The idea is that when the player, which is a KinematicBody2D node, intersects the Area2D, the Area2D will send a signal to its parent, the enemy. However, whenever the player and enemy intersect, nothing happens. Does it have to do with the fact that both bodies are moving? I have tried using the
body_enter signal, and even gave the player its own Area2D and used the
area_enter signal. Neither method appears to work.
The Area2D node is connected to the enemy node by the following line of code in the
$Area2D.connect("area_entered", self, "_on_body_entered")
And the signal connects to the following method:
However, as evidenced by no output being printed to the console, this method is never called.
I tried placing the following code directly into the enemy's Area2D, but still no results:
connect("area_entered", self, "_on_area_entered")
I also tried the above with
Here are the collisions:
And here are the node trees: