public void update(Game G){
		// updates the balls position in the level
		if (Px + Vx > G.getWidth()-radius-1){
			// if the ball is hitting the right side of the screen, make it bounce off
			Px = G.getWidth()-radius-1;
			Vx = -Vx*energyLoss;
		}else if (Px+Vx < radius){
			Px = radius;
			Vx = -Vx*energyLoss;
		}else{
			Px += Vx;
		}
		
		if (Py == G.getHeight()-radius-1){
			// if the ball is on the ground slow the ball
			Vx *= friction;
			if (Math.abs(Vx) < 0.2){
				// if the ball is moving slow enough stop the ball
				Vx = 0;
			} 
		}
		
		if(Py > G.getHeight()-radius-1){
            Py = G.getHeight()-radius-1;
            Vy *= energyLoss;
            Vy = -Vy;
        }else{
            // velocity formula
            Vy += gravity*dt;
            // position formula
            Py += Vy*dt + 0.5*gravity*dt*dt;
        }
	}