public void Animate(){
		int i,j;

		this.potentialEnergy = 0;
		this.kineticEnergy = 0;		
		this.momentumX = 0;
		this.momentumY = 0;
		this.centre_of_mass_x=this.planets[0].posX;
		this.centre_of_mass_y=this.planets[0].posY;
		this.total_mass = 0; // used for Centre of Mass

		for(i = 0; i < this.numberOfPlanets; i++) {
// only do this once, so for j > i. attract will work out the new incremental velocity vectors for both objects 
// and return the total potential energy
			for(j = i +1 ; j < this.numberOfPlanets; j++) {
				this.potentialEnergy += this.planets[i].Attract(this.planets[j],this.gravity);
			}

			this.planets[i].Move();
			this.total_mass += this.planets[i].mass;
			this.centreOfMass.posX = this.centre_of_mass_x+=(this.planets[i].mass/this.total_mass)*(this.planets[i].posX-this.centre_of_mass_x);
			this.centreOfMass.posY = this.centre_of_mass_y+=(this.planets[i].mass/this.total_mass)*(this.planets[i].posY-this.centre_of_mass_y);

				// add up kinetic energy
			this.kineticEnergy += (	(this.planets[i].velocityX * this.planets[i].velocityX) + 
						(this.planets[i].velocityY * this.planets[i].velocityY)) * 
						(this.planets[i].mass/2);
			this.momentumX += this.planets[i].mass * this.planets[i].velocityX;
			this.momentumY += this.planets[i].mass * this.planets[i].velocityY;
		}
	}