What is the best way to check collisions between Area2D?

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

What is the best way to check collisions between Area2D? (In addition to using the old “if area is preload (path)”, which ends up in many cyclic dependency problems.

:bust_in_silhouette: Reply From: kidscancode

Areas can detect overlap with other areas in two ways:

  1. Using area_entered and area_exited signals.
  2. Using get_overlapping_areas().

Generally speaking, option #1 is the most reliable, as get_overlapping_areas() is only updated once during the physics step, and so may not be accurate if the areas are moved before you call it.