int board[][] = new int[26][26];
void setboard()
{
for (int i = 0;i<25;i++)
{
for (int z = 0;z<25;z++)
{
board[i][z] = 0;
}
}
}
void setup(){
background(255,255,255);
size(500,500);
setboard();
}
void draw()
{
for (int i = 0;i<25;i++)
{
for (int z = 0;z<25;z++)
{
fill(125,0,125);
if (board[i][z]==1) rect(i*50,z*50,50,50);
}
}
}
void mouseClicked()
{
background(255,255,255);
setboard();
for (int i = 0;i<25;i++)
{
for (int z = 0;z<25;z++)
{
if (mouseX > i*50 && mouseX < i*50+50 && mouseY > z*50 && mouseY < z*50+50 )
{
board[i][z] = 1;
}
}
}
}
|