We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a SuperCreature class which is extended by a creature (currently only one, called Shy). I want all the Shy objects to be aware of all the other SuperCreatures so they can avoid them, hence their name. How would I do that? I have a CreatureManager class as well that is primarily an arraylist of SuperCreatures with some handy management things so it's only one line to update all the creatures and things of that nature. I considered giving every SuperCreature a copy of the manager but that would cause recursion issues as well as be difficult to update. I also tried just giving all of them an arrayList of other SuperCreatures which is a little easier to keep up to date but a similar problem occurs. Thank you for your time!
Answers
The best way would be for the CreatureManager class to supervise the creature-creature interactions since it is aware of all the creatures. In the Creature class you have a method that has a single parameter of type SuperCreature to perform the actual interaction if any.