Hi there!
It sounds to me like you are very upset and confused right now, and rightfully so.
Being confused and not knowing where you stand is a horrible feeling. It sounds to me like this guy either 1) Can't decide what he wants, or 2) Is playing with you, by having a bit of fun and then pulling back when he realises you want more than that.
I agree with Cookie. Put your foot down and take a stand. Ask him what he wants and tell him that you don't want to be messed about anymore. Explain that what he is doing has hurt you and if he can't make up his mind and tell you what he wants, then walk away.
It's not worth wasting time on people who are just going to mess you about. Go out there and find yourself a guy who won't leave you hanging on a string. If he is a decent guy he will stop leading you on and then pulling back.
That's not to say you can't still be friends but make it clear that it goes no further than that until he decides what he wants. I know that it's difficult but you deserve respect and letting you know where you stand is a simple respect for your feelings! Be firm.
If you do get together then good luck and I hope everything goes well for you.
For the time being, try not to focus on him too much, you might be overlooking someone else who is better and will treat you with the respect and honesty you deserve.
Good luck and keep smiling. : )