class Rocket { float rx, ry, sx, sy; float ax, ay; Rocket(int iX, int iY) { //Constructor, this function build a rocket. this.rx = iX; this.ry = iY; this.sx = 0; this.sy = 0; this.ax = 0; this.ay = 0; } void goTime() { //Handles all the movement and drawing for each rocket this.ay += 0.001; this.sx += this.ax; this.sy += this.ay; this.rx += this.sx; this.ry += this.sy; strokeWeight(3); //line thickness stroke(255, 255, 255);//line color line(this.rx, this.ry, this.rx + this.sx, this.ry + this.sy); } void light() { //Some random values to get things going this.ax = random(1) - 0.5; this.ay = -0.2 + random(1); } } Rocket spaceX, blueOrigin; //Individual Rockets Rocket[] icbm = new Rocket[1000]; //A boat load of rockets! void setup() { size(500, 500); //This is how you run the contructor functions to actually create each rocket (make variable etc) spaceX = new Rocket(width / 2, height - 100); blueOrigin = new Rocket(width / 2 + 50, height - 100); for(int i=0; i < icbm.length; i++) icbm[i] = new Rocket(floor(random(width)), height - 100); } void draw() { fill(0); rect(0, 0, width, height); spaceX.goTime(); blueOrigin.goTime(); for(int i=0; i < icbm.length; i++) icbm[i].goTime(); } void mousePressed() { spaceX.light(); blueOrigin.light(); for(int i=0; i < icbm.length; i++) icbm[i].light(); }