- Code: Select all
int n;
double mindist = 100;
actors = getAllActorsInCollision("Event Actor", &n);
if(actors)
{
int i;
for(i = 0; i < n; i++)
{
if(strcmp(actors[i].name, "enemy1") == 0)
{
double d = distance(parent.x, parent.y, actors[i].x2, actors[i].y2);
if(d < mindist)
{
closest = (actors + i);
mindist = d;
}
}
}
}
if(!closest)
{
targetx = -500;
targety = 3000;
}
else if(closest)
{
targetx = closest->x2;//LINE 28 IS THIS ONE
targety = closest->y2;//WHY NO ERROR HERE?
}
targetx = closest->x2; again for anger lol