READ: error in invalid memory area what does that mean?
Posted: Tue Jul 28, 2009 7:45 pm
I keep getting a run time error on line 28, i've tried everything i know how to but no result..... can anyone help me? the code is here and if you don't know how to fix it can anyone tell me what it means? Thanx. The code is to get the closest enemy1 and set the targetx and targety as their x2 & y2. I marked line 28
targetx = closest->x2; again for anger lol
- 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