how to determine if a player is in this area

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By xoheveras

Code for Enemy, enemy is kinematicbody

func _on_Area2D_body_entered(body): 
if "Player" in
pass # Replace with function body.

Player is kinematicbody

Pls help me… i dont fixedes it’s failde is 3 Days

:bust_in_silhouette: Reply From: gioele

If both enemy and player are KinematicBody2D you should not use and Area2D signal.

But probably in your enemy scene you have an Area2D to detect if player get’s within a certain distance.

Anyway, you should check if == "Player": as you are comparing two strings.

Keyword in should not be used in this case.