while its on top of the player code but its "while(1)" ahyway i changed it by (me) but its the same. the whole its long becaus eit has a some other movements is this
var floor;
var gm_percentage;
var stand_percentage;
var jump = 0;
var SJ = 0;
var Q = 0;
var J = 0;
var js = 0;
var rt = 0;
var s = 0;
var z = 0;
var counter = 10;
var peeking = 0;
var air = 0;
function main()
{
level_load("prog.wmb");
}
function still()
{
c_move(me,nullvector,vector(0, 0, 0), GLIDE);
}
action player_script()
{
player = my;
var distance, angle;
VECTOR temp;
distance = 100;
angle =0;
while(me)
{
if(player)
{
camera.x = player.x-distance*cos(angle);
camera.y = player.y-distance*sin(angle);
camera.z = player.z+20;
vec_set(temp,player.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
angle -= (joy_5-joy_6)*4*time_step;
angle %= 360;
ent_animate(me,"stand",stand_percentage, ANM_CYCLE); // "walk" animation loop
stand_percentage += 4* time_step;
if(joy_force.x)
ent_animate(me,"gm",gm_percentage, ANM_CYCLE); // "walk" animation loop
gm_percentage += 10* time_step;
if(joy_force.y)
ent_animate(me,"gm",gm_percentage, ANM_CYCLE); // "walk" animation loop
gm_percentage += 10* time_step;
c_move(me,vector(0, 0, 0),vector(0, 0, -0.7), GLIDE);
vec_set(temp.x, my.x);
temp.z -= 10000;
floor = c_trace(my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE); // compute the distance between player's origin and the floor below its feet
if(joy_4 && floor < 30 && jump == 0 && J == 0)
{
jump = 1;
}
if(jump == 1)
{
c_move(me,vector(0, 0, 20*time_step), nullvector, GLIDE);
J = 1;
}
if(floor > 30)
{
jump = 2;
}
if(floor < 1 && !joy_4)
{
jump = 0;
J = 0;
}
////////////////////////////////////////////
if(joy_7 && floor < 1)
{
still();
}
else
{
c_move(me, nullvector, vector(joy_force.y * 3 * time_step, -joy_force.x * 3 * time_step, 0), GLIDE);
}
//////////////////////////////////////////////////////
vec_to_angle(my.pan, vector(sign(joy_force.x),sign(joy_force.y),0));
my.pan -= 0;
/////////////////////////////////////////
if(!joy_4 && joy_7)
{
z = 1;
}
///////////////////////////////
if(z == 1 && joy_4 && floor < 60 && SJ == 0 && js == 0)
{
SJ = 1;
}
if(SJ == 1)
{
c_move(me,vector(0, 0, 10*time_step), nullvector, GLIDE);
js = 1;
}
if(floor > 60)
{
SJ = 2;
}
if(floor < 1 && !joy_7)
{
SJ = 0;
js = 0;
z = 0;
}
///////////////////////////////////////////////////////////////////////////
if(!joy_7 && floor > 1)
{
s = 1;
}
if(s == 1 && floor > 1 && joy_7)
{
c_move(me,vector(0, 0, -20*time_step), nullvector, GLIDE);
}
if(floor < 1)
{
s = 0;
}
////////////////////////////////
if(!joy_4 && floor > 1)
{
air = 1;
}
if(air == 1 && floor > 1 && joy_4)
{
c_move(me,vector(0, 0, 2*time_step), nullvector, GLIDE);
}
if(floor < 1)
{
air = 0;
}
/////////////////////////////////////////////////
if(key_space)
{
while(counter > 0)
{
c_move(me,vector(10*time_step, 0, 0),vector(0, 0, 0), GLIDE);
counter -= time_step;
wait(1);
}
}
}
wait(1);
}
}