if else error
in
Programming Questions
•
1 year ago
Hello, I'm trying to create a processing sketch that will alternate images as a press different keys. For some reason I keep getting an error saying 'expecting RCURLY found else'.. I'm pretty new at this so I'm unsure what this really means. All my images are loaded into the file and everything. Thanks!
// Click on the image to give it focus,
// and then press any key
int value = 0;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
void setup() {
img1 = loadImage("http/youtu-1.jpeg");
img2 = loadImage("http/www.youtube.jpeg");
img3 = loadImage("6a00d8341bf66653ef010536dc9ddb970b-400wi.jpeg");
img4 = loadImage("Types_de_plumes.jpeg");
img5 = loadImage("301457_10150329346062198_509082197_8317990_1418770294_n.jpeg");
img6 = loadImage("538874_10150635903690636_91375910635_9720087_876896913_n");
}
void draw() {
fill(value);
rect(25, 25, 50, 50);
size(200, 200);
}
void keyPressed () {
if (key == 'k'|| key == 'K'); {
image(img1, 0, 45);
else if (key == 'd' || key = 'D');
}
if (key == 'q'|| key == 'Q'); {
image(img2, 0, 45);
} else if (key == 'd' || key = 'D');
if (key == 'r'|| key == 'R'); {
image(img3, 0, 45);
} else if (key == 'd' || key = 'D');
if (key == 'z'|| key == 'Z'); {
image(img4, 0, 45);
} else if (key == 'd' || key = 'D');
if (key == 'e'|| key == 'E'); {
image(img5, 0, 45);
} else if (key == 'd' || key = 'D');
if (key == 't'|| key == 'T'); {
image(img6, 0, 45);
} else if (key == 'd' || key = 'D');
}
}
1