How to use getLoadedAt()

Discussion in 'Developer Support' started by DesignDecay, Jun 20, 2015.

  1. Can someone give me some guidance on how to properly use getLoadedAt(). More specifically I am trying to perform an action on a specific GameObject when there are multiple in the vicinity.
  2. When you say multiple in the viscinity, do you mean near each other or on the same tile? And i'd recommend using queries instead of the getLoaded methods (in all areas)
  3. Near each other.
    --- Double Post Merged, Jun 20, 2015, Original Post Date: Jun 20, 2015 ---
    Erm... How do I PM you?
  4. Okay so basically getLoadedAt() can be used to get the object(s) loaded at a specified coordinate and can be filtered by name or id.
    It returns a locatable query result which is a special list of the objects found at that coordinate. On this list you can call .first() .last() .nearest() etc. to select a gameobject from the list.
    For example
    Code (Text):
    2. private GameObject go = GameObjects.getLoadedAt(new Coordinate(1,2,3), "Door").nearest();
    Of course, don't forget to null check. But yeah, as i said before, i recommend using .newQuery() and chaining queries to that. It allows you to filter via multiple different things and the code looks nice and clean.

Share This Page