I've been trying to code something that makes it so when an actor is within range then another actor appears but this has proved challenging (On my part). I've been trying different ways to do it but can never pin point it.
Thanks in advance.


1 | private Proximity proxObj = null ; |
1 | proxObj = new Proximity(); |
1 2 3 4 5 | if ((proxObj.getWorld() == null ) != getObjectsInRange(< range >, OtherActor. class ).isEmpty()) { if (proxObj.getWorld() == null ) getWorld().addObject(proxObj, < x, y >); else getWorld().removeObject(proxObj); } |