Hi guys,
I have had one frustrating day with Flash today. Have been on it for 8 hours trying to figure out whats wrong with my code. Am counting the number of horizontal walls and storing their respective coordinates in space (Y coordinates only as it is constant for a horizontal wall).
Having done that am sorting the walls in order of their positions in space.
Example:
hor_num ==> no. of walls (3)
horizontal_wall[1]==>stores the y position of wall 1 in space and so on.
trace("Actual values found: "+horizontal_wall);
for (j=0;j<hor_num;j++)
{
p=0;
while(p<=hor_num)
{
if (horizontal_wall[p] > horizontal_wall[p+1])
{
// Swap
temp1=horizontal_wall[p];
horizontal_wall[p]=horizontal_wall[p+1];
horizontal_wall[p+1]=temp1;
}
p=p+1;
}
}
trace("After sorting values found: "+ horizontal_wall);
The output is really weird.
Actual values found: 200,300,50
After sorting values found: 200,300,50
For some reason it gives 2 comma characters and another thing which i found after hours of debugging was that the if condition becomes true even though the first value is smaller than the second one.
Hope somebody out there can resolve this problem. Would really appreciate