in practice I create the tile passing them row and column:
int a=0;
for (int c = 0; c <colonne; c++) {
for (int r = 0; r <righe; r++) {
arraymatonelle[a] =new mattonella();
arraymatonelle[a].crea(r, c, (a==(mattonellaVuota)), a);
a++;
}
}
then the tile calculates the coordinates by itself:
void crea(int r, int c, boolean sevuoto,int a) {
numero=a;
Rigaecolonna.set(r, c);
img = createImage(width/ righe, height/ colonne, RGB);
cordinateFoto.set( Rigaecolonna.x*img.width, Rigaecolonna.y*img.height);
cordinate.set( Rigaecolonna.x*img.width, Rigaecolonna.y*img.height);
cordinatecopia.set( Rigaecolonna.x*img.width, Rigaecolonna.y*img.height);
vuoto=sevuoto;
}
then, always the tile is drawn in the coordinates:
lato1.vertex(cordinate.x,cordinate.y, cordinate.z, 0, 0);
the photos show the result but I don’t understand why, sorry but a mcve it is difficult for me to do it!
thank you