This is quite basic, I think, but for some reason I just can't get my head around it:

I have a fighter who can block, but of course he shouldn't be able to block when another fighter comes up behind him. So basically all I want to do is have it so that if the attacker is within the range -40 degrees to +40 degrees in front of the player (ie player's blocking range) and player's blockmode is on, he blocks, otherwise he gets hurt. I tried subtracting you.pan from my.pan and vice versa (you is set to the other player) and trying a number of conditions (eg. if(you.pan-my.pan>260)&&(you.pan-my.pan<100)...argh), but I'm missing something...

Thanks,
Keith