我正在尝试在代码的底部循环绘制梯子,在此绘制了三个梯子,并从左向右增加梯子,以制作一个单面梯子金字塔:
(我知道这很乱)
float k;
float y;
float z;
float x;
float v;
float xx;
float w = 20;
float spacing = 20;
float rungWidth = 5;
float numRungs = 1000;
void setup() {
size(700, 500);
}
void draw() {
background(255);
noStroke();
fill(0, 220, 0);
drawRedLadder (k, y, 20, 5);
我正试图做一个循环来增加这部分。
for(float xx = 100; x < 700; x += spacing) {
rect(x, y, rungWidth, 50);
rect(x, z, 25, rungWidth);
rect(x+w, y, rungWidth, 50);
x = x + spacing;
fill(0,220,0);
for(float p = 100; x < 700; x += spacing) {
rect(150, 395, rungWidth, 50);
rect(150, 417, 25, rungWidth);
rect(170, 395, rungWidth, 50);
x = x + spacing;
rect(150, 345, rungWidth, 50);
rect(150, 370, 25, rungWidth);
rect(170, 345, rungWidth, 50);
x = x + spacing;
}
}
}