Why does he ignore me but get jealous?

This guy I had a crush on this guy who has stopped talking to me. He didn't give me a reason. He's been ignoring me and avoiding me. When I come anywhere near him, he turns his back to me or he starts talking to someone else near him. Then he moves away somewhere else. He hasn't talked to me in a while but he keeps an eye on me. He stares at me when I'm talking to any guy. Right after he sees me talking to them, he will come over and talk to me then goes back to that ignoring phase again. Other times he tries to make me jealous by flirting with girls that he knows Im friends with. Its so childish and petty. Its annoying how someone won't talk to you but keeps staring and listening to you talk to other guys. He does it in a stalkish way too.
Why does he ignore me but get jealous?
Post Opinion