Robot Army
void RobotArmy(float x_coord, float y_coord)
{
ellipse(x_coord+48,y_coord-20,10,10); //antena's sphere on top
rect(x_coord+13,y_coord+43,50,75); //robot's body
rect(x_coord+25,y_coord+35,25,8); //robto's neck
rect(x_coord+20,y_coord-3,35,40); // robot's head
rect(x_coord+45,y_coord-15,5,13); // anthena's pole piece
rect(x_coord+18,y_coord+117,40,15); //robot's waist
rect(x_coord+20,y_coord+133,35,10); //robot's lower body
}
void setup()
{
size(1340,705);
background(50);
fill(25,220,25);
int y,x;
for(y=0;y<12;y++)
{
for(x=0;x<19;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
{
fill(0);
}
else
{
fill(0,255,0);
}
}
else
{
if(x%2==1)
{
fill(0,255,0);
}
else
{
fill(0);
}
}
RobotArmy(x*70,y*50+25);
}
}
save("robot.png");
}

No comments:
Post a Comment