I have a pretty good grasp of the turret behavior and it's working well but each of them are doing full 360 degree targeting and i'd like to limit it to say.. 180 degrees or even narrower ranges.. otherwise still just trying to target whatever is within range AND within a certain degree of rotation range.
Maybe there is some way to determine the angle of difference between two objects? and i'd need to compare something like:
1. is the object an enemy?
2. if it is an enemy is it in range?
3. if it is in range, is it within the angle of attack based on the current turret in question
4. if it is, then fire..
My close to successful approach was simply to compare the X of the turret with the X of the enemy.. this worked fine with a single target, but things got weird when I had to then compare multiple enemies. I made a family called "Enemy" and compared the X of that enemy class and it works pretty well even with multiple targets but i hit some snags where it still didn't perfectly right..
I wanted to try and use families because it seemed like the better way to handle many enemies rather than making a bunch of unique unit objects with their own variables, etc..