It's kind of a weird situation that will take some explaining, but I'll do my best..

So it started me meeting this one girl (girl A), and I liked her for a while but she didn't feel the same way. Turns out she was just leading me on for a long time and was seeing some other guy most of the time.
However, while she was doing this, one of her friends (girl B) liked me, and so girl A was telling her friend, girl B, to pursue me.
Girl B had been in a relationship for 2 years or so, but that had ended a few months prior. We started texting each other every day and things like that, when eventually it started to heat up a bit and she was sending me photos of her in her underwear and things like that. I was in the process of moving to the city where she'd also recently moved, and she suggested we be sex buddies.
Meanwhile the whole time I was still into girl A, but found out she really didn't like me the same way and was messing with me and girl B. Eventually everything got figured out, and me and girl B were both mad at girl A for while. She really helped me get through the situation and eventually we started hanging out and fooling around.
For a few weeks I would go to her house, or her to mine and we'd cuddle and kiss for hours. A few times it went a bit further then that, and we almost had sex one time but decided against it at the last minute.

After a few weeks pass, I find myself really liking girl B, but then she decides to call it all off.
It turns out that her ex (who was a friend of a friend of mine, but who I wasn't really friends with) and her had almost got back together a few times while she was texting me and sending the photos of herself, so he was upset about that. But the whole time she would always complain about how he'd make her life hell and was just a terrible person.

Anyway her reasoning for not wanting to get together anymore was that she didn't want ex to be mad at her. Even though she didn't love him anymore, if he hated her she would be sad.

I still like her a bunch, and she's told me that there's no real chance of anything happening, but I don't want to give up just yet.

Sorry for the long-winded post, but I'd be grateful for any advice.