Okay, it looked like it had worked, but not so. It works fine from the center of the playing feild, which is my starting point. But once I move the character to other places it gets buggy and get begin to look in the wrong direction and acts as though the mouse is right over top of him. Here my code for aiming
while(1)
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = -1000;
vec_for_screen(temp,camera);
vec_to_angle(my.pan,temp); // now MY looks at YOU
my.tilt=0;
my.roll=0;
wait(1);
camera.x=my.x;
camera.y=my.y;
}
You can Download my level so far
HERE (3.19 MB) .
Try moving the character away from the center of the screen, you'll see the problem.
Controls are W,A,S,D and mouse to aim.