class Bodies { //variables float bodiesy, bodiesx; color skycolor; int h; //holder for hour int skymultiplier; //Constructor Bodies () { smooth(); fill(0); skycolor =color (18, 29, 90); } void display(int temphour) { h=temphour; smooth(); noStroke(); fill(skycolor); rect(0,0,width, 300); this.calcPosition(); //gets x, y, color, and backcolor } void calcPosition () { if (h >= 0 && h < 6) { //from 0 to 6 bodiesx=map(h, 0, 6, width/2, width); bodiesy=map(h, 0, 6, 100, height-100); skymultiplier=16*(6-h); this.drawmoon(); } if (h >= 6 && h < 12) { //from 6 to 12 bodiesx=map(h, 6, 12, 0, width/2); bodiesy=map(h, 6, 12, height-100, 100); skymultiplier=h*10; this.drawsun(); } if (h >= 12 && h < 18) { //from 12 to 18 bodiesx=map(h, 12, 18, width/2, width); bodiesy=map(h, 12, 18, 100, height-100); skymultiplier=(23-h)*10; this.drawsun(); } if (h >= 18 && h <= 23) { //from 0 to 6 bodiesx=map(h, 18, 23, 0, width/2); bodiesy=map(h, 18, 23, height-100, 100); skymultiplier=(h-17)*16; //not 18, to keep from an infinite loop this.drawmoon(); } } void drawsun() { skycolor=color (70+skymultiplier, 70+skymultiplier, 255); for (float i = 0; i <= 80; i = i+4) { fill(255, 255, 0, 10); ellipse(bodiesx,bodiesy, 70+i, 70+i); } fill(255, 255, 0, 255); ellipse(bodiesx,bodiesy, 70, 70); } void drawmoon() { skycolor=color (8, 8, 113); //skymultiplier=50; for (int z=0; z < skymultiplier; z++){ stars[z].display(); println(z); //println(skymultiplier); } for (float i = 0; i <= 50; i = i+4) { fill(195, 195, 224, 10); ellipse(bodiesx,bodiesy, 60+i, 60+i); } fill(185, 185, 139, 255); ellipse(bodiesx,bodiesy, 60, 60); } }