1 decade ago by BeachBum
I have 2 batches of Entities created that fight each other. Much of that is working but the method i'm currently using to select the next enemy does some crazy business sometimes.
I'm keeping track of all my entities in a 2D array and then sorting it by nearness every time an Entity is killed. The Entity that killed the last enemy then selects the top item off the array and heads for him. This is requiring some ugly array slicing and extra work to keep my array of the Entities updated. I think there must be methods within ImpactJS that can get me the next closest enemy or at least an updated list of Type A/B entities that are still around.
What would you suggest?
Thanks
I'm keeping track of all my entities in a 2D array and then sorting it by nearness every time an Entity is killed. The Entity that killed the last enemy then selects the top item off the array and heads for him. This is requiring some ugly array slicing and extra work to keep my array of the Entities updated. I think there must be methods within ImpactJS that can get me the next closest enemy or at least an updated list of Type A/B entities that are still around.
What would you suggest?
Thanks