int [] xpos = new int[50];//x pos for all the circles
int [] ypos = new int[50];//y pos for all the circles
int StarCount = 1000;//number of total stars on screen
float[] posX = new float[StarCount];//x pos for stars
int[] posY = new int[StarCount];//y pos for stars
void setup()
{
size(1000, 1000);
smooth();
ellipseMode(CENTER);
noCursor();
//make the first circle
for (int i = 0; i < xpos.length; i++)
{
xpos[i] = 0;
ypos[i] = 0;
}
}
void draw()
{
background(0);
//Marina helped me out a lot with the star code, similar to her rain drop code
for (int i=0; i<=StarCount-1; i++)
{ //# iterations of star
if (posY[i]<1)
{ //stars starts falling from top
if (i>=1 && posY[i-1]>=150)
{ //if previous star has significant distance from start
posX[i] = random(0, 1001); //randomize star X
for (int j=0; j<=12; j=j+3)
{ //gradient star
if (100+(j*13) >= 255)
{
fill(255);
rect(posX[i], posY[i]+j, 2, 7);
} else
{
fill(0, 70+(j*13), 100+(j*13));
rect(posX[i], posY[i]+j, 2, 3);
}
}
posY[i]++; //Y+1
}
else if (i>=1 && posY[i-1]<=150)
{ //if previous star DOES NOT have sig. distance
}
else
{
posY[i]++; //Y+1
}
}
else if (posY[i]<1000)
{ //star has not yet reached bottom of screen
for (int j=0; j<=12; j=j+3)
{ //gradient star
if (100+(j*13) >= 255)
{
fill(255);
rect(posX[i], posY[i]+j, 2, 7);
}
else
{
fill(0, 70+(j*13), 100+(j*13));
rect(posX[i], posY[i]+j, 2, 3);
}
}
posY[i] = posY[i]+20; //add between Y (fall)
}
else
{ //star has reached bottom of screen
posY[i] = 0; //reset to top
}
}
//shifting the array values
for (int i = 0; i < xpos.length-1; i++)
{
xpos[i] = xpos[i+1];
ypos[i] = ypos[i+1];
}
//new location
xpos[xpos.length-1] = mouseX;
ypos[ypos.length-1] = mouseY+50;
//draw
for (int i = 0; i < xpos.length; i++)
{
noStroke();
fill(#E3E5E5 + i * 5);
ellipse(xpos[i], ypos[i], i+50, i+50);
//line(xpos[i],ypos[i],i,i);
}
drawRocketShip();
}
void drawRocketShip()
{
fill(#9B9696);
rect(mouseX-50, mouseY-250, 100, 250);//core
fill(#CE4747);
triangle(mouseX, mouseY-350, mouseX-50, mouseY-250, mouseX+50, mouseY-250);//tip
triangle(mouseX-100, mouseY-100, mouseX-50, mouseY-100, mouseX-50, mouseY-200);//left wing
triangle(mouseX+50, mouseY-100, mouseX+100, mouseY-100, mouseX+50, mouseY-200);//right wing
fill(#56D3E0);
ellipse(mouseX, mouseY-200, 50, 50);//windows
ellipse(mouseX, mouseY-100, 50, 50);
fill(#515555);
quad(mouseX-50, mouseY, mouseX+50, mouseY, mouseX+100, mouseY+50, mouseX-100, mouseY+50);//thrusters
}
void keyPressed()//tried to implement keyboard controls
{
if (key == CODED)
{
if (keyCode == UP)
{
//increse rocket+circle x pos
} else if (keyCode == DOWN)
{
//decrease rocket+circle x pos
}
}
}