此代码处理错误

Processing error with this code

float speed = 1;
void setup() {
size(400, 300);
}

void draw() {
background(255);
move();
display(); 
}

void move() {
x = x + speed;
if (x > 350) {
speed = 0;
}
}

void display(x,y) {
fill(#FF2121);
translate(x,y);
ellipse(0, 0, 60, 60);
rect(-10, 15, 20, 100);
}  

意外令牌:"Void display (x,y)" 上的 x 基本上这个程序将椭圆和矩形移动到 window 的另一边。这是正确的方法吗?或者有没有其他简单的方法。

例子 0 = 椭圆 [] = 矩形

移动到window的另一边(速度1),当它撞到边缘时,他们都停下来。

参数需要类型,就像变量一样。

void display(float x, float y) {

另请注意,由于您的 display() 函数需要 2 个参数,因此在没有任何参数的情况下调用它是非法的,这正是您在 draw() 函数中所做的。

另请注意,您从未定义 x 变量,因此这是另一个错误。

请养成 working in smaller chunks 的习惯,而不是试图一次编写所有程序。你这里有很多错误,如果不修复其他错误就很难修复一个。我建议从更简单的东西重新开始,只有当你有一些有用的东西时才继续前进。