我想知道如何使用for循环多次创建此生物,随时更改代码

时间:2018-10-16 17:06:07

标签: processing

void square(float x, float y, float width, float height)
{
    rect(x,y,width,height); // main body
}

void eyes(float x, float y, float width, float height)
{
    ellipse(x,y,width,height); //left eyes
    ellipse(x,y,width,height); //right eyes
}

void mouth(float startPostionX, float startPostionY, float endPostionX, float endPostionY)
{
    line(startPostionX,startPostionY,endPostionX,endPostionY); //mouth  
}

void nose(float startPostionX, float startPostionY, float endPostionX, float endPostionY)
{
    line(startPostionX,startPostionY,endPostionX,endPostionY); //nose
}

void creature()
{
    square(240,300,100,150);//main body
    strokeWeight(6);
    eyes(265,325,30,30);//left eyes
    point(265,325); //left pupils 
    eyes(320,325,30,30);//right eyes
    strokeWeight(6);
    point(320,325); //right pupils 
    mouth(265,390,320,390);//mouth

    strokeWeight(3);// increase size of point
    stroke(255,223,0);

    //point(290,367);
    nose(293,345,293,367); 
}

void setup()
{
    size(600,600); //set size of canvas screen 
    creature(); 
}

0 个答案:

没有答案