My question is, how is it that I can have multiple instances of a sprite with AI that will behave independently from each other?
I have Drones in my game for mining asteroids. They have an instance variable for Cargo, and when it is below 1,000 they target asteroids to mine. Once Cargo exceeds 1,000 they return to the nearest Space Station to unload.
The problem I am running into is that as soon as one Drone wants to return, suddenly all Drones want to return. This problem is the result of me using Turret behavior for Drones to target either asteroids or stations, when one gets reprogrammed, they all get reprogrammed.
I could conceivably recreate turret behavior from scratch in a way that avoids this issue, but I would continue to run into similar issues in other areas of AI.
I could make many, many clones of the "Drone" sprite which all have their own unique events to program their AI, but this would be incredibly tedious especially since I plan on having a wide variety of Drones for performing different tasks.
Reading that I have done on this topic suggests that independent behavior among multiple instances could be accomplished with lists or arrays, but no articles or videos offered thorough explanations of how that actually works.