Apologies if this has been answered out there, I have looked, a lot and have not been able to find anything that fully explains what I'm after.
My basic problem is keeping track of everything relating to an enemy instance, for example:
I have 10 instances of an enemy spaceship each one having:
a vision cone
What is the best way for making sure that when something happens to one of these objects I can relate it back to the right enemy?
I currently have everything in a container which is working for the health bar(which scales its length based on an instance variable on the enemy), however, when info goes the other way it applies to everything, for example:
Enemy vision cone collides with the player, firing event triggers for all instances.
Player projectile hits enemy shield, shield strength variable is decremented for all instances.
I thought something to do with assigning the same ID to everything in the container on create might work but I can't work out how to do the check like:
vision cone ID = 34
-> Enemy ID = 34 -> Spawn bullet
I hope this makes sense, I'm not too experienced yet but I figure this would be really helpful to nail as early as possible so I can get my core gameplay up and running.