I think a good part of what you're dealing with is a fair bit of immaturity on her part. I agree with everyone else, you know. There's a time when it becomes more than enough, the behavior, and it either needs adjusted (i.e. she needs to grow up a bit), or you need to move on, no matter how much it hurts initially.
Playing mind games with someone who is in a relationship with another is just one of those things that points to the overall immaturity factor. Obviously, this girl isn't ready to commit to any form of a serious relationship, whether just dating or something more.
Then there's the distance you're saying she displays with you, but not her friends. If anything, it should be the other way around. If she's affectionate with her friends, she should be (in a healthy relationship) more affectionate with you privately. At the very least, she would be showing the same to you as to her friends.
Something else that you should consider, is that one should be as happy at being alone, and comfortable with themselves BY THEMSELVES, as they are when in a relationship. Because otherwise, then you'll find yourself in a relationship just because you don't want to be alone.