Goto Problem

Posted By: Martek

Goto Problem - 10/31/07 13:36

Hi, at the moment I programm a AI. This I follows a path an on each edge it wait.
If the AI see the player it attack. But in the time, while it is wait at the
edge, it doesn't shoot on the player. I try this, but it don't work.
Code:
 		if(c_trace(my.x, player.x, ignore_me + ignore_passable) > vec_dist(my.x, player.x) - 50)
{
see_player:
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;
my.roll = 0;

my.skill53 = 0;
my.take_shoot = 0;
my.skill52 = 0;
while(my.skill52 < 100)
{
ent_animate(me, "attack", my.skill52 , null);
my.skill52 += 8 * time_step;
//enemy_shoot();
wait(1);
}
while(my.skill53 < 100)
{
if(c_trace(my.x, player.x, ignore_me + ignore_passable) > vec_dist(my.x, player.x) - 50)
{
goto(see_player);
}
ent_animate(me, "stand", my.skill53, anm_cycle);
my.skill53 += 8*time_step;
wait(1);
}
}



Mfg, Pingulord
Posted By: Martek

Re: Goto Problem - 11/01/07 13:18

Ich hab es gelöst. Hatte die IF abfrage in der falschen while drin.

Mfg, Pingulord
Posted By: Joey

Re: Goto Problem - 11/03/07 20:23

wie wärs eigentlich mit nem einfachen break; ?
Posted By: Martek

Re: Goto Problem - 11/03/07 21:21

Ich habe es zwar schon gelöst, aber das wäre auch eine Idee.
Vielen Dank
© 2023 lite-C Forums