我正在尝试修改绘制正方形的当前方法:
length = 100;
int index = 1;
while (index <= 4) {
tParam.forward(length);
tParam.turn(90);
index++;
}
基本上无法弄清楚要改变tParam.turn();
的内容。帮助
答案 0 :(得分:0)
这应该有效:
int height = 100; //the height of the rectangle
int width = 200; //the width of the rectangle
for(int i = 0; i < 2; i++) //repeat the following twice
{
tParam.forward(height); //go forward the height of the rectangle
tParam.turn(90); //turn 90 degrees
tParam.forward(width); //go forward the width of the rectangle
tParam.turn(90); //turn 90 degrees
} //end loop