PImage black_checker;
PImage white_checker;
int arrayfields[][] = new int[8][8];
void setup() {
size(500, 500);
black_checker = loadImage("black.png"); //изображение шашки 50x50
white_checker = loadImage("white.png");
for (int i = 0;i < 8;i++)
{
for (int z = 0; z < 8; z++)
{
arrayfields[i][z] = 0;
}
}
for (int i = 0;i < 8;i++)
{
for (int z = 0; z < 8; z++)
{
fill(255,255,255);
if (i%2 == 0 && z%2 == 0 )
{
arrayfields[i][z] = 1;
fill(0,0,0);
}
if (i%2 == 1 && z%2 == 1)
{
arrayfields[i][z] = 1;
fill(0,0,0);
}
rect(i*50,z*50,50,50);
if (z < 3 && arrayfields[i][z] == 1)
image(white_checker,i*50+(25)/2,z*50+(25)/2,25,25);
if (z > 4 && arrayfields[i][z] == 1)
image(black_checker,i*50+(25)/2,z*50+(25)/2,25,25);
}
}
}
void draw() {
}
|