BMAP* arrow = "cursor.tga";
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,IGNORE_ME);
if(hit.x != NULL)
{
vec_set(temp.x,hit.x);
}
}
function move_mouse();
function playerAct();
function main()
{
video_mode = 8;
video_screen = 2;
level_load("test2.WMB");
wait(2);
mouse_mode = 1;
mouse_map = arrow;
move_mouse();
}
function move_mouse()
{
while(1){vec_set(mouse_pos,mouse_cursor); wait(1);}
}
var walk_prosent;
var stand_prosent;
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)>=250) //>=40
{
c_move(me,vector(10*time_step,0,0),nullvector,IGNORE_ME|IGNORE_PASSABLE|GLIDE);
ent_animate(me,"walk",walk_prosent,ANM_CYCLE);
walk_prosent += 6 * time_step;
}
else{
ent_animate(my, "stand", stand_prosent, ANM_CYCLE); // then play its "stand" animation
stand_prosent += 5 * time_step;
}
wait(1);
}
}