Friday, 6 September 2013

Java:Trying to read the numbers out of a string in a loop, fails when I attempt to change the array number

Java:Trying to read the numbers out of a string in a loop, fails when I
attempt to change the array number

Basically my loops works fine as this:
for(y=0; y<10; y++){
for(x=0; x<10; x++){
tileNum = row[column].charAt(x) - '0';
tiles[tileNum].draw(x*tileSize,y*tileSize);
}
}
but fails when I add this line:
for(y=0; y<10; y++){
column++;
for(x=0; x<10; x++){
tileNum = row[column].charAt(x) - '0';
tiles[tileNum].draw(x*tileSize,y*tileSize);
}
}
I have no clue why, but I figure there's something about string arrays or
loops I'm not realizing. Any way around this?

No comments:

Post a Comment