4
« on: November 09, 2018, 11:35:26 am »
Ok, so let me start off with my understanding of things.
I have a player follow behavior, it checks player 1 (and 2 if two players are on screen) and adds their X and Y locations to a list. I used a loop to handle it all, and everything is working splendidly. X and Y locations for Player 1 and Player 2 are being tracked in a list and all is well.
Now, what I want to do is actually have the enemies stay away from each other... but I have two ideas for an approach to this logic and I would love some input.
My first approach is to create a new list for enemy locations. The problem is that I plan to have approximately 12-16 enemies on screen at once at some point, and I want to know, before I jump too far into it, if anyone has experience messing around with Always updating a list and issues with performance?
My second approach is to make each enemy a "sensor" and compare their own X/Y locations to the last collided enemy actor, and adjust accordingly. Currently the enemies move directly towards the closest player, but I'm sure that I could easily add a quick "if not colliding with enemy group" to their follow behaviors, and have them avoid their buddies by "if collided with enemy group, compare X/Y and move away"
What are your thoughts? I would love to get some feedback before I delve in. Thanks!