the EOF error seems to really like to show up, could someone help me get rid of it?
in
Programming Questions
•
1 month ago
So I made a program to try and make a circle go downwards, but I want to be able to move it left and right also, but when I put in the 'if' commands it start to say 'expected EOF, found if', could someone help me and, also, tell me what EOF actually means, here's the code
void setup() {
size(500, 500);
}
void draw() {
background(255);
move();
display();
}
color c = color(0);
float x = 250;
float y = 0;
float speed = 1;
void move() {
y = y + speed;
if (y > width) {
y = 0;
}
}
if (keyPressed && keyPressed == 'd')
void move() {
x = x + speed;
if (x > width) {
x = 0;
}
}
if (keyPressed && keyPressed == 'a')
void move() {
x = x - speed;
if (x > width) {
x = 0;
}
}
void display() {
fill(c);
fill(244, 0, 12);
ellipse(x, y, 20, 20);
}
Thanks
1