class Snow { float xpos; float xorig; float xoff =0; float ypos; float snowSize; float speed; float[] vals; Snow(){ xorig = random(-200,width); ypos = -100; snowSize = random(0,18); speed = random(1,5); vals = new float[25]; // 25 is dot numbers for TWO PI for (int i =0; i < vals.length; i++) vals[i] = random(1,4); } void display(){ fill(0,10); float f0 = 0.0; beginShape(POLYGON); int count1 = 0; while(f0 < TWO_PI) { vertex(xpos + cos(f0)*(33-snowSize) + vals[count1], ypos + sin(f0)*(33-snowSize) + vals[count1]); f0 += PI/12.0; count1++; } endShape(); fill(0,5); float f1 = 0.0; beginShape(POLYGON); int count2 = 0; while(f1 < TWO_PI) { vertex(xpos + cos(f1)*(27-snowSize) + vals[count2], ypos + sin(f1)*(27-snowSize) + vals[count2]); f1 += PI/12.0; count2++; } endShape(); fill(0,10); float f2 = 0.0; beginShape(POLYGON); int count3 = 0; while(f2 < TWO_PI) { vertex(xpos + cos(f2)*(20-snowSize) + vals[count3], ypos + sin(f2)*(20-snowSize) + vals[count3]); f2 += PI/12.0; count3++; } endShape(); fill(0,10); float f3 = 0.0; beginShape(POLYGON); int count4 = 0; while(f3 < TWO_PI) { vertex(xpos + cos(f3)*(18-snowSize) + vals[count4], ypos + sin(f3)*(18-snowSize) + vals[count4]); f3 += PI/12.0; count4++; } endShape(); fill(0,15); float f4 = 0.0; beginShape(POLYGON); int count5 = 0; while(f4 < TWO_PI) { vertex(xpos + cos(f4)*(15-snowSize) + vals[count5], ypos + sin(f4)*(15-snowSize) + vals[count5]); f4 += PI/12.0; count5++; } endShape(); } void move(){ ypos += speed; xpos = xorig+noise(xoff)*400; xoff +=0.01; } //Check if it hits the bottom boolean rechedbottom() { if(ypos>height){ return true; } else{ return false; } } }