I'm becoming crazy, I'm stop here trying to fix this from one week.
So, I'm here to ask you help, cause I think that what I've done mustn't work like this.
Code:
action moveplayer
{
my.enable_entity=on;
my.event = Touch_me;
player = me;
my.push=1;
my.polygon=on;
ready_to_play = 0;
while (my.z > 100) /cutescene
{
my.x += 8 * time;
my.z -= 5 * time;
if (my.z > 220)
{
vec_set(temp, my.x);
vec_sub(temp, camera.x);
vec_to_angle(camera.pan, temp);
}
else {
camera.x = my.x - 100;
camera.z = my.z + 20;
camera.y = my.y;
vec_to_angle(camera.tilt, temp);
}
wait (1);
}
// Now start the game
playershoot();
while (1)
{ c_move (my, nullvector, vector(5, 0, 0), glide);
camera.x = my.x + 120;
camera.z = my.z + 500;
camera.tilt = -90;
camera.roll = 0;
ready_to_play = 1;
// move the ship
if (key_cul == on && my.y < 210) // press and hold the "Up" arrow key to move
{
c_move (my, nullvector, vector(0, 5, 0), glide);
if (my.roll < 30)
{
my.roll += 3 * time;
}
}
if (key_cur == on && my.y > -210) // press and hold the "Down" arrow key
{
c_move (my, nullvector, vector(0, -5, 0), glide);
if (my.roll > -30)
{
my.roll -= 3 * time;
}
}
wait (1);
}
}
Tha's the action of the player, ok, this work fine, the problem is with the enemy.
Code:
action enemy {
my.push=1;
my.polygon=on;
while(ready_to_play == 1)
{
my.z = player.z;
if(my.x <= (player.x + 330)){
c_move(me,nullvector,vector(-2,0,0), glide);
}
wait(1);
}
}
All of this doesn't work, i really don't know why,
Create a while loop after the cutescene, then,
if the player is close to the enemy 330(x), the enemy start moveing.
enemy.z = player.z (this piece is important, why it doesn't work?)
Thx all for help