Why are guys SO confusing

Okay so I'm in highschool and this guy and I have always kind of flirted we hooked up once last year (not sex) and we are still friends sometimes we will talk about getting together again but at school he acts like we're barely friends, When other girls are around he clearly shows more interest in them than me unless I'm the only girl than we flirt.. How do I divert his interest to me > the other girl when we're in class together?