Hi all, super newbie here with a few questions!
How do I troubleshoot my code where parts of my sketch are moving in one direction and other parts move in another direction? I am applying x++ and y++ to the entire sketch. I know if has to do with my coordinates, but not sure what to look out for.
Also, my rectangle and a few ellipse shapes are stretching out while they move across the page, how do I constrain them to make sure they keep their original shape?
Here is my before and after code, thanks friends!
Original sketch:
size(760,560); // set size of window
background(255); // set background to white
//left foot
line(240,500,260,480);
line(240,500,260,520);
line(260,520,300,500);
line(300,500,280,480);
//right foot
line(440,480,420,500);
line(420,500,460,520);
line(460,520,480,500);
line(480,500,460,480);
//left leg
fill(127);
rect(260,420,20,60,127);
//right leg
fill(127);
rect(440,420,20,60,127);
//body
line(140,420,580,420); //base
line(140,420,180,360); //left corner
line(580,420,540,360); //right corner
//left wing
bezier(180,360,140,320,100,260,80,220); //bottom wing cuve
bezier(240,260,200,260,120,240,80,220); //top wing curve
//right wing
bezier(540,360,580,320,640,260,660,220); //bottom wing curve
bezier(500,260,560,260,600,240,660,220); //top wing curve
//head
line(300,180,360,100); //left side
line(440,180,380,100); //right side
line(360,100,380,100); //top
//feathers
bezier(360,100,320,60,310,40,300,20); //left feather left curve
bezier(300,20,310,40,360,60,360,100); //left feather right curve
bezier(370,100,350,60,380,20,400,0); //center feather left curve
bezier(400,0,380,40,350,80, 370,100); //center feather right curve
bezier(380,100,400,40,420,40,460,40); //right feather left curve
bezier(440,40,420,50,400,60,380,100); //right feather right curve
//eyebrows
noFill(); // left eyebrow
beginShape();
vertex(300, 140);
bezierVertex(260,120,240,140,210,180);
endShape();
noFill(); // right eyebrow
beginShape();
vertex(440, 140);
bezierVertex(460,120,540,140,540,180);
endShape();
//eyes
ellipseMode(CORNER); //set ellipseMode is top left CORNER
fill(255); // set fill to white
ellipse(225, 172, 95, 100); //left white ellipse
ellipseMode(CORNER); //set ellipseMode to CORNER
fill(100); // set fill to gray
ellipse(255,230,40,40); // left gray ellipse
ellipseMode(CORNER); //set ellipseMode is top left CORNER
fill(255); // set fill to white
ellipse(420, 172, 95, 100); //right white ellipse
ellipseMode(CORNER); //set ellipseMode to CORNER
fill(100); //set fill to gray
ellipse(450,230,40,40); //right gray ellipse
//beak nostrils
fill(255); // set fill to white
ellipse(360,260,5,20); //left
ellipse(380,260,5,25); //right
//beak
line(300,300,320,300); //left short line
line(320,300,380,360); //left long line
line(440,300,420,300); //right short line
line(420,300,380,360); //right long line
//belly lines
noFill();
beginShape();
vertex(260,420);
bezierVertex(240,410,230,390,220,360); // left belly line
endShape();
noFill();
beginShape();
vertex(460,420);
bezierVertex(480,410,490,390,500,360); // right belly line
endShape();
Moving sketch applying x++ y++
float x = 50;
float y = 50;
void setup() {
size(760,560); // set size of window
}
void draw() {
background(255); // set background to white
//left foot
line(x + 190, 500, y + 210, 480);
line(x + 190, 500, y + 210, 520);
line(x + 210, 520, y + 250, 500);
line(x + 250, 500, y + 230, 480);
//right foot
line(x + 390, 480, y + 370, 500);
line(x + 370, 500, y + 410, 520);
line(x + 410, 520, y + 430, 500);
line(x + 430, 500, y + 410, 480);
//left leg
fill(127);
rect(x + 210, y + 370, -30 + x, y + 10, 127);
//right leg
fill(127);
rect(x + 390, y + 370, -30 + x, y + 10, 127);
//body
line(x + 90, 420, y + 530, 420); //base
line(x + 90, 420, y + 130, 360); //left corner
line(x + 530, 420, y + 490, 360); //right corner
//left wing
bezier(x + 130, y + 310, x + 90, y + 270, x + 50, y + 210, x + 30, y + 170); //bottom wing cuve
bezier(x + 190, y + 210, x + 250, y + 210, x + 70, y + 190, x + 30, y + 170); //top wing curve
//right wing
bezier(x + 490, y + 310, x + 530, y + 270, x + 590, y + 210, x + 610, y + 170); //bottom wing curve
bezier(x + 450, y + 210, x + 510, y + 210, x + 550, y + 190, x + 610, y + 170); //top wing curve
//head
line(x + 250, y + 130, x + 310, y + 50); //left side
line(x + 390, y + 130, x + 330, y + 50); //right side
line(x + 310, y + 50, y + 330, y + 50); //top
//feathers
//noFill();
bezier(x + 310, y + 50, x + 270, y + 10, x + 260, -10 + y, x + 250, -30 + y); //left feather left curve
bezier(x + 250, -30 + y, x + 260, -10 + y, x + 310, y + 10, x + 310, y + 50); //left feather right curve
bezier(x + 320, y + 50, x + 300, y + 10, x + 330, -30 + y, x + 350, -50 + y); //center feather left curve
bezier(x + 350, -50 + y, x + 330, -10 + y, x + 300, y + 30, x + 320, y + 50); //center feather right curve
bezier(x + 330, y + 50, x + 350, -10 + y, x + 370, -10 + y, x + 410, -10 + y); //right feather left curve
bezier(x + 390, -10 + y, x + 370, -50 + y, x + 350, 10 + y, x + 330, 50 + y); //right feather right curve
//eyebrows
noFill(); // left eyebrow
beginShape();
vertex(x+250, y+90);
bezierVertex(x + 210, y + 70, x + 190, y + 90, x + 160, y + 130);
endShape();
noFill(); // right eyebrow
beginShape();
vertex(x + 400, y + 80);
bezierVertex(x + 410, y + 70, x + 490, y + 90, x + 470, y + 130);
endShape();
//eyes
ellipseMode(CORNER); //set ellipseMode is top left CORNER
fill(255); // set fill to white
ellipse(x + 175, y + 122, 95, 100); //left white ellipse
ellipseMode(CORNER); //set ellipseMode to CORNER
fill(100); // set fill to gray
ellipse(x + 205, y + 180, 40, 40); // left gray ellipse
ellipseMode(CORNER); //set ellipseMode is top left CORNER
fill(255); // set fill to white
ellipse(x + 370, y + 122, 95, 100); //right white ellipse
ellipseMode(CORNER); //set ellipseMode to CORNER
fill(100); //set fill to gray
ellipse(x + 400, y + 180, 40, 40); //right gray ellipse
//beak nostrils
fill(255); // set fill to white
ellipse(x + 310, 260, -45 + y, 20); //left
ellipse(x + 330, 260, -45 + y, 25); //right
//beak
line(x + 250, 300, y + 270, 300); //left short line
line(x + 270, 300, y + 330, 360); //left long line
line(x + 390, 300, y + 370, 300); //right short line
line(x + 370, 300, y + 330, 360); //right long line
//belly lines
noFill();
beginShape();
vertex(x + 210, y + 370);
bezierVertex(x + 190, y+360, x+180, y+340, x+170, y+310); // left belly line
endShape();
noFill();
beginShape();
vertex(x + 410, y + 370);
bezierVertex(x + 430, y + 360, x + 440, y + 340, x + 450, y + 310); // right belly line
endShape();
x++; // increment x + y by 1 each time through the loop
y++;
}