Hi,
I got a problem on this line:
PImage imgCell[i] = imgSource.get(0, 0, cellWidth, cellHeight); // Assign
If I dont use the for loop but just use:
//PImage imgCell0 = imgSource.get(0, 0, cellWidth, cellHeight); // Assign
then it runs fine (unless I place that in the for loop).
I get, syntax error, maybe missing semicollon
What did i do wrong?
Code:PImage imgSource;
PImage[] imgCell; // Declare
int cellWidth = 32;
int cellHeight = 32;
int cells; //total ammount of cells
int rows, columns;
void setup(){
size(500, 500);
imgSource = loadImage("test.png");
columns = imgSource.width/cellWidth;
rows = imgSource.height/cellHeight;
cells = rows*columns;
imgCell = new PImage[cells]; // Create
noLoop();
}
void draw(){
for(int i=0; i<columns; i++){
PImage imgCell[i] = imgSource.get(0, 0, cellWidth, cellHeight); // Assign
}
//PImage imgCell0 = imgSource.get(0, 0, cellWidth, cellHeight); // Assign
//PImage imgCell1 = imgSource.get(32, 0, cellWidth, cellHeight); // Assign
//PImage imgCell2 = imgSource.get(64, 0, cellWidth, cellHeight); // Assign
image(imgCell0, 0, 0);
//image(imgCell1, 32, 0);
//image(imgCell2, 64, 0);
}