function setup() { createCanvas(800,800) ballx = random(width) bally = random(height) snowballxs = [] snowballys = [] moonx = random(0,width) moony = random(0,400) directionxs = [] directionys = [] for(i=0;i<100;i++){ snowballxs[i] = random(width) snowballys[i] = random(height) directionys[i] = random(-2,2) directionxs[i] = random(-2,2) } } function draw() { background(0) fill(255,0,0) ellipse(ballx,bally,50,20) ballx += 1 bally += 1 if(ballx> width){ ballx=0 } if(bally > height){ bally=0 } fill(255) for(i=0;i<snowballys.length;i++){ thisx = snowballxs[i] thisy = snowballys[i] snowballxs[i] +=directionxs[i] snowballys[i] +=directionys[i] if(snowballxs[i]> width){ snowballxs[i] = 0 }else if(snowballxs[i]< 0){ snowballxs[i] = width } if(snowballys[i] > height){ snowballys[i]=0 }else if(snowballys[i]< 0){ snowballys[i] = height } ellipse(thisx,thisy,10,10) } fill(200,200,200) ellipse(moonx,moony,100,100) fill(255,100,100) rect(200,height-200,400,height) fill(255,200,100) rect(350,height-100,50,height) }