Hey, guys, I really don't get how to use a body_enter function, please explain.
I got two nodes Player and Enemy and they both are KinematicBodies2D.
Enemy node has got an Area2D node in it with script like this:
extends Area2D
func _ready():
connect("body_enter", self, "_on_enemy_body_enter")
func _on_enemy_body_enter(body):
print("Collision")
if (body.get_name == "Player")
print("Ouch!")
I also have tried to add an Area2D to Player node and to change areas to RigidBodies2D but nothing seems to be working at all.
What am I doing wrong?