Getting message that y is not defined

class Drop {
	float x = random(0, width);
	float y = random(-100, -300);
	float ySpeed = 2;

	void fall() {
		y = y + ySpeed
		
		if (y < height) {
			y = random(-100, -300);
			
		}
	}

	void show() {
		stroke(192, 225, 228);
		line(x, y, x, y + 10);
	}


} //end



Drop[] drops = new Drop[200];

void setup() {
	size(640, 360);
	for (int i = 0; i < drops.length; i++;) {
		drops[i] = new Drop();
	}
}


void draw() {
	background(100);
	
	for (int i = 0; i < drops.length; i++) {
	drops[i].fall();
	drops[i].show();
		
}

}



Problem occurs with this code

if (y < height) {
			y = random(-100, -300);
			
		}

you are missing a semi-colon. welcome to where’s wally programmer style.

2 Likes

Missing semicolon

Remember to hit ctrl-t when in processing

Thanks :slight_smile: didnt see it

im using chromebook so im using openprocessing

1 Like

Hello @Kenga123456,

Please mention that you are using Chromebook and OpenProcessing in future posts.

It helps us help you.

:)

sure :wink:

filler, filler