Hi There,
I want to know if there is an Area2D in a certain position of the viewport…
I see the way to do it is with get_overlapping_areas()… so I do next:
The main tree is a Node2D with 2 childs positioned at the same coordinates, every child is a scene with tree (Area2D),and 2 childs Sprite2D and CollisionShape2D.
Just trying to understand if get_overlapping_areas() is the function I need…
if I code: func _ready():
var area1:Area2D=get_node(“1”) as Area2D
var area2:Area2D=get_node(“2”) as Area2D
var areas= area1.get_overlapping_areas()
$Log.text=str(areas)
areas=
What I am not understanding?, it there a easier way to know if any object is in a certain position?
Oh Thanks, now I see that the problem is I am trying to do it in the Ready function… I see it also works in _process and _physics_process… which I still don’t understand is why in the Ready function is not working, my idea was to make a random dungeon tile map just inside the Ready funcion…
If I want to place an Sprite2D on the right hand side of an existing one, how can I check if the space is empty or busy with another Sprite2D?, I can only do that by checking the overlapping area2D in the process or physic_process funcs then?
is there another way to check that in the ready function?