VECTOR* move_vec[3]; // needed vector to move player
VECTOR* temp[3]; // temporary vector to perform angle calculations
action move_me() // attach action to player in WED
{
player = me;
float theta = 0.0;
while (1)
{
move_vec[0] = (key_w - key_s)*5 *time_step; // move player on x axis
move_vec[1] = (key_a - key_d) *5 *time_step; // move player on y axis
c_move(me,move_vec,nullvector,GLIDE); // function to actually move player, with GLIDE collision
if(mouse_left==1)
{
theta+= 0.08 * time_step;
vec_set(camera.x,vector(me.x +(300 * sin(theta)),me.y +(300 * cos(theta)),camera.z)); // actual rotation code, (300 is the radius)
vec_set(temp,me.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp); // camera always face the player
}
if(mouse_right==1)
{
theta-= 0.08 * time_step;
vec_set(camera.x,vector(me.x +(300 * sin(theta)),me.y +(300 * cos(theta)),camera.z)); // actual rotation code, (300 is the radius)
vec_set(temp,me.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp); // camera always face the player
}
if(mouse_left==0 && mouse_right==0)
{
camera.x = me.x - 300;
camera.y = me.y;
camera.z = me.z+300;
vec_set(temp,me.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
}
wait (1);
}