Your so-called "defense mechanism" is a very double-edged sword. While it may work at first, it'll eventually end up placing you in the friend zone, so be sure to not overdo it.
Here's something you must realize about girls - they like funny guys, but being funny isn't enough. Usually "class clowns" act silly a lot, do funny things to try people laugh. But that just isn't enough. There are A LOT of funny guys out there. It doesn't take much. So by being funny, you're not being much different than other guys. And if you're not being different, she's not gonna notice you. Yes, she'll know who you are. Yes, she will talk with you. But when I say "notice", I mean she won't be attracted to you.
So you gotta spice things up. Usually the best way to go with this is with flirting. And with flirting, you have to let them know that you're interested in them. This is why a lot of shy guys have trouble with girls - they don't really have enough confidence to flirt, and don't want to show the girl how they feel about her. You have to assume the girl is interested in getting with you! You have to BELIEVE the girl is interested in you! You have to have confidence!
If you see a girl that you like, walk up to her and show her you're interested in her! I'm not saying you go to her and tell her that you have a crush on her, or anything like that. Just talk to her, try getting to know her, be funny (but not in a retarded way - save that for later), and let her know you're interested in her. She'll either like you or not. If she doesn't, you move on! Don't waste your time with girls who aren't into you - they're everywhere, and you have to learn to accept that they're not worth it.
There's other small things I'm not gonna get into because it'll take me hours explaining everything. Things like "don't be too nice", "don't talk to her ALL the time", "don't open up too quickly", and so on. Basically, don't just try being funny. Work towards letting her know that you're interested in her, while being as much of yourself as you possibly can. And try making her feel special. Like she's more important than any other girl. OK I'll stop now because I get the feeling I'm confusing you. ~__~