In the Shooting Enemies & Collision Layers lesson it is shown that to check if the rocket collide with an enemy the 2D Physics Layers are used, which it might be the best solution to actually check if a specific object collide with another one.
However during the challenge I thought that to check if an object collide with another one I could simply check if the area entered is from a specific class and if it is then executed a specific method.
This is the code I have used on_area_entered signal:
func _on_hit(area:Area2D):
# Remove the laser
self.queue_free()
if area is Enemy:
area.destroy()
My question is if it is also ok to check which object collide the rocket, or laser in my case, by simply doing a check of which class is the area object collided?