Game/core/src/com/mygdx/game/GravShooter.java
/*
		 * calculates the position of the asteroid, after taking in 'gravitational' effects from the 'planet'
		 */
calculates the position of the asteroid, after taking in 'gravitational' effects from the 'planet'
calculates the position of the asteroid after taking in ' gravitational ' effects from the ' planet '
public void update()
		{
			Double r = Math.pow(x, 2.0) + Math.pow(y, 2.0);
			Double dv = 1700000.0 * Gdx.graphics.getDeltaTime() * p_mass/r;
			Double dvx = Math.abs(dv*(x/Math.sqrt(r)));
			Double dvy = Math.abs(dv*(y/Math.sqrt(r)));
			if (x>0) {
				dvx = -dvx;
			}
			if (y>0) {
				dvy = -dvy;
			}
			vx += dvx*Gdx.graphics.getDeltaTime();
			vy += dvy*Gdx.graphics.getDeltaTime();
			Double dx = (vx)*Gdx.graphics.getDeltaTime();
			Double dy = (vy)*Gdx.graphics.getDeltaTime();
			x += dx;
			y += dy;
		}
public void update ( ) { Double r = Math . pow ( x , 2.0 ) + Math . pow ( y , 2.0 ) ; Double dv = 1700000.0 * Gdx . graphics . getDeltaTime ( ) * p_mass / r ; Double dvx = Math . abs ( dv * ( x / Math . sqrt ( r ) ) ) ; Double dvy = Math . abs ( dv * ( y / Math . sqrt ( r ) ) ) ; if ( x > 0 ) { dvx = - dvx ; } if ( y > 0 ) { dvy = - dvy ; } vx += dvx * Gdx . graphics . getDeltaTime ( ) ; vy += dvy * Gdx . graphics . getDeltaTime ( ) ; Double dx = ( vx ) * Gdx . graphics . getDeltaTime ( ) ; Double dy = ( vy ) * Gdx . graphics . getDeltaTime ( ) ; x += dx ; y += dy ; }
calculates the position of the asteroid, after taking in 'gravitational' effects from the 'planet'
calculates the position of the asteroid after taking in ' gravitational ' effects from the ' planet '