Hello I am making a PirateShip Actor that goes to the nearest treasure chest. using an ArrayList of the chests how would I find the nearest chest to my pirate ship on the grid. Thank you in advance.
If you have the PirateShip's Location and an ArrayList of chests, then I would first suggest turning the List of chests into a List of Locations of chests. Then:
This will set closest to the nearest Location in the list, and you can get the chest in that Location using /* insert name of grid here */.get(closest)
If you have the PirateShip's Location and an ArrayList of chests, then I would first suggest turning the List of chests into a List of Locations of chests. Then:
This will set closest to the nearest Location in the list, and you can get the chest in that Location using /* insert name of grid here */.get(closest)