I'm working on a 2D tile based game. I want NPC's to be able to destroy tiles, and ideally I would have a function, which takes a central x,y and then based upon a circular area from that point (radius) gives me all the tiles that fall within that circular area so I can destroy them.

Any ideas as to how to do this?

  • \$\begingroup\$ closely related (almost duplicate) gamedev.stackexchange.com/questions/16306/… \$\endgroup\$
    – jhocking
    Mar 21, 2015 at 16:08
  • \$\begingroup\$ The most dumb approach would be to check the distance between each of your tiles with the central x,y and if the distance is below the specified radius, add the tile to a set, and pass that set to your npc. Now how to do it code-wise depends a lot on your implementation... \$\endgroup\$
    – Vaillancourt
    Mar 21, 2015 at 18:43


You must log in to answer this question.

Browse other questions tagged .