I have written a code for a project and when combining the codes I got a “unexpected token: void” error. I get and error on the void “cansleft() {”. Pleas helppp
Here is my code
import processing.sound.*;
SoundFile file;
void setup() {
size(1000, 700);
background (60, 191, 204);
fill(150);
rect ( 0, 550, 1000, 235);
building();
cansleft();
file = new SoundFile(this, "Antony Santos - Antologia De Caricias (1993).mp3");
file.play();
file.amp(1);
cansright();
dude();
}
void draw()
{
strokeWeight (1);
fill(255, 204, 0);
ellipse (1000, 0, 200, 200); //Sun
strokeWeight (0);
fill(255);
ellipse (0+100, 105, 350, 95);
ellipse (0+250, 30, 200, 75);
ellipse (0+400, 60, 200, 75);
ellipse (0+600, 40, 200, 60);
ellipse (0+700, 60, 250, 70);//clouds
}
void building () {
fill(255, 3, 62);
beginShape();
vertex (100, 100);
vertex (950, 100);
vertex ( 950, 550);
vertex ( 850, 600);
vertex ( 50, 600);
line ( 50, 150, 100, 100);
endShape();
fill(255, 3, 62);
rect ( 50, 150, 800, 450);
fill(230, 247, 255);
rect ( 50, 150, 800, 300);
fill(255, 3, 62);
line (850, 150, 950, 100); //(corner)
//shelves
fill(184, 183, 180);
rect ( 50, 150, 800, 135);
line ( 50, 200, 850, 200); //( frame)
line ( 50, 240, 850, 240); //(frame)
line ( 250, 150, 250, 285);
line ( 450, 150, 450, 285);
line ( 650, 150, 650, 285);
line ( 50, 450, 850, 450);
}
void dude() {
fill(255,255,153);
ellipse(500,300,75,75);
rect(487.5,337.5,25,30);
fill(47,53,255);
rect(450,337.5,100,150);
fill(255,255,153);
rect(425,337.5,25,100);
rect(550,337.5,25,100);
fill(47,53,255);
rect(425,337.5,25,25);
rect(550,337.5,25,25);
rect(450,487.5,50,100);
rect(500,487.5,50,100);
fill(102,51,51);
rect(450,587.5,50,20);
rect(500,587.5,50,20);
void cansleft() {
float canX=50;
float canY = 150;
for (int r = 0; r <3; r++) {
for (int i = 0; i <19; i++) {
fill (random(255), random(255), random(255));
rect (canX, canY, 15, 30);
canX=canX+20;
}
canX=50;
canY = canY + 35;
}
}
void cansright() {
float canX=450;
float canY = 150;
for (int r = 0; r <3; r++) {
for (int i = 0; i <19; i++) {
fill (random(255), random(255), random(255));
rect (canX, canY, 15, 30);
canX=canX+20;
}
canX=450;
canY = canY + 35;
}
}