so I am trying to do movement of a image with the arrow buttons and it says “the operator == is undefined for the argument type(s) Boolean, int” (i have no clue how to fix this and i don’t understand why it is happening) I have my code here it would really help if someone can tell me what is happening
//images
PImage up_frog;
//movement variables
int x = 225;
int y = 650;
void setup() {
//set size
size(500, 700);
//load images
up_frog = loadImage("Frog.png");
}
void draw() {
//make 1st grass
fill(0, 255, 0); //green
rect(-1, 600, 501, 100);
//make 2nd grass
fill(0, 255, 0); //green
rect(-1, 300, 501, 100);
//make 3rd grass
fill(0, 255, 0); //green
rect(-1, -1, 501, 100);
//make 1st road
fill(0); //black
rect(-1, 400, 500, 200);
//make 2nd road
fill(0); //black
rect(-1, 100, 500, 200);
//make 1st road lines
for (int road = -1; road <= 701; road += 80) {
fill(255, 255, 255); //white
rect(road, 495, 40, 20);
}
//make 2nd road lines
for (int road = -1; road <= 701; road += 80) {
fill(255, 255, 255); //white
rect(road, 190, 40, 20);
}
//frog
image(up_frog, x, y);
up_frog.resize(0, 50);
// go back from end
if (x < 0) {
x = 255;
}
}
void keypressed() {
//movement
if (key == CODED) {
//move up
//Pressed
if (keyPressed == UP) {
y = y - 50;
} else if (keyPressed == DOWN) {
y = y+50;
} else if (keyPressed == LEFT) {
x = x- 50;
} else if (keyPressed == RIGHT) {
x = x +50;
}
}
}