I'm trying to get my loop to go through the array 16 times. When I use upCollisions[i], it doesn't work but when I use upCollisions[0] or any other index of the array, it works. I can't understand why it is not working using the for loop.
Here's my code:
public void handleUpArrow()
{
int upCollisions[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,};
for(int i =0; i < 16; i++)
{
if(goldenBallPosition == upCollisions[i])
{
}
else
{
jBGrid[goldenBallPosition].setIcon(imageSand);
jBGrid[goldenBallPosition -16].setIcon(imageBall);
goldenBallPosition -= 16;
jBCompass.setIcon(imageCompassNorth);
jTDirection.setText("N");
jTSquare.setText((""+goldenBallPosition));
}
}
}