`I am trying to make a tile game where you are supposed to put the numbers in order. So I couldn’t get the numbers into the last row and I trying to get them to move. There isn’t supposed to be a square on the bottom right corner so you and shift the squares(numbers).
int value=0;
int abc = 0;
int cols = 4;
int rows = 4;
int[][] myArray = new int[cols][rows];
void setup() {
size(400, 400);
background(255, 0, 0);
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
myArray[i][j] = abc++;
}
}
}
void draw()
{
for (int i = 0; i < cols; i++)
{
for (int j = 0; j < rows; j++)
{
fill(255);
rect(100*i, 100*j, 100, 100);
fill(0);
text(myArray[i][j], 100*i+20, 100*j-30);
}
}
}
void mouseReleased() {
}
that was not a array problem ( that one is good ), but
when j == 0
you draw the text at -30 ( above canvas )
so you could have noticed that the numbers not start with “0”
( like first line missing // and not the last )
so…
your above first code still not run-able,
and you also not posted the new corrected code down here.