void setup ()
{
PImage dinoImage_1, dinoImage_2;
dinoImage_1 = loadImage("http://www.b1t-m0nkey.com/code/intro_code/ex_015_images/data/dino.png");
dinoImage_2 = loadImage("http://www.b1t-m0nkey.com/code/intro_code/ex_015_images/data/dino2.png");
size(500,500);
int y,x;
for(y=0;y<5;y++)
{
for(x=0;x<5;x++)
{
if(y%2==0) //determine if you are on an even row
{
if(x%2==1) //determine if you are on an even column
{
image(dinoImage_1,x*100,y*100,100,100);
}
else
{
image(dinoImage_2,x*100,y*100,100,100);
}
}
else
{
if(x%2==1)
{
image(dinoImage_2,x*100,y*100,100,100);
}
else
{
image(dinoImage_1,x*100,y*100,100,100);
}
}
}
}
}
No comments:
Post a Comment