I'm not sure how to put this properly. I'm a complete newbie when it comes to logic statements and programming in general, so I'll try to be as clear as I possibly can.
Here is what I want to do:
I want the NPCs for this instance of my game to always face the player when the player is within a set range, and set its layering so that it is in front of the player when the player "goes behind" the NPC, and behind the player when the player "goes in front" of the NPC. I would like them all to act independently, but use the same code and come from the same object, so I don't have to create 100 different NPC's that basically do the same thing.
Essentially, what I want is for the player to approach an NPC and for that NPC to face that player and layer itself accordingly, without the others changing their own values that are not within range.
What I have now:
I can get ONE NPC to track the player based on his X and Y in relation to him, and layer itself accordingly.
If I add another, it just flat out breaks. I have no idea how to make them independent of each other.
<img src="https://dl.dropbox.com/u/33658489/blargh.jpg" border="0" />
This is what I have as far as scripting goes.
<img src="https://dl.dropbox.com/u/33658489/blargh2.jpg" border="0" />
This is what the layout looks like. I want these guys both to face the player independently of one another.
Any help would be appreciated. Thank you.