#include <acknex.h>
#include <default.c>
function playerAct();
function point_mouse();
function move_mouse();
BMAP* arrow = "arrow.bmp";
function main()
{
video_mode = 8;
video_screen = 2;
level_load("test.mdl");
ent_create("soldier.mdl", nullvector, playerAct);
wait(3);
mouse_mode = 1;
mouse_map = arrow;
move_mouse();
}
function move_mouse()
{
while(1){vec_set(mouse_pos,mouse_cursor); wait(1);}
}
VECTOR temp;
function point_mouse()
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = 5000;
vec_for_screen(temp,camera);
c_trace(camera.x,temp.x,IGNORE_ME);
if(hit.x != NULL)
vec_set(temp.x,hit.x);
//wait(1);
}
function playerAct()
{
camera.z += 200;
camera.tilt -= 35;
c_setminmax(me);
VECTOR temp2; vec_zero(temp2);
ANGLE my_angle; vec_zero(my_angle);
while(1){
point_mouse();
if(mouse_left==1){
while(mouse_left){wait(1);}
vec_set(temp2,temp.x);
vec_sub(temp2,my.x);
vec_to_angle(my.pan,temp2); // now MY looks at YOU
my.tilt = 0;
temp2.z = my.z;
}
if(vec_dist(my.x,temp2)>=40)
{
c_move(me,vector(7*time_step,0,0),nullvector,IGNORE_ME|IGNORE_PASSABLE|GLIDE);
}
// else{
// play stand animation here or something like that
// }
wait(1);
}
}