0 votes

Basically, I'm trying to find specific tiles that are inside of an Area2D and delete them. I have an idea on how I could this, but it would be really complicated and barely functional. Is there any easy way to do this?

Godot version 3.2.3
in Engine by (112 points)

1 Answer

0 votes


I haven't done this, but I think you should be able to do get_overlapping_bodies() in your Area2D script (returns a list of the bodies in the area). So something like:

func _ready()
    for body in self.get_overlapping_bodies():

This assumes that you have collision shapes on the tiles and that they are on a collision layer that the Area2D interacts with.

by (594 points)

But that would delete the whole tilemap, because if you use get_overlapping_bodies() it returns the tilemap node, not individual tiles, right?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.