code snippet:
void checkcollision()
{
float x1 = tanks[0].x;
float y1 = tanks[0].y;
float x2 = tanks[1].x;
float y2 = tanks[1].y;
float dist = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
float dr = tanks[0].rad+tanks[1].rad;
if(dist<dr);
{
printf("checkcollision read true\n");
printf("dist: %f, radius+radius: %f\n",dist,dr);
goback(0); goback(1);
}
}
output:
checkcollision read true
dist:363.159302, radius+radius:14.142136
goback executed for tank 1
goback executed for tank 2
I just need someone to break down why this might happen. I don't get it. Do conditional operands not work on float?