Hello. I am making a 2d platformer where there is an enemy. My enemy is an area 2d it moves left and right. If the player touches the player takes damage but when a bullet touches it dies. the names of my player and bullet scene is "Player" and "Bullet" respectively.(just a note my bullet is an area 2d)
so here is my code for detection of player and the bullet
func _on_Area2D_body_entered(body):
if body.get_name() == "Bullet":
queue_free()
if body.get_name() == "Player":
get_tree().reload_current_scene()
however, my bullet does not disappear after hitting my enemy and my player is also going through the enemy without reloading the scene.
bullet collision layer 2 mask 2
enemy collision layer 1&2 mask 1&2
player collision layer 1 mask 1
so how should I do this?