Index: src/com/example/helloandroid/Fleet.java
===================================================================
--- src/com/example/helloandroid/Fleet.java	(revision 17dfb52ab4f48e224ffd883f42c6e11edfaa852f)
+++ src/com/example/helloandroid/Fleet.java	(revision b15ff93ecfa240908580ca99eb54fb784918edad)
@@ -16,9 +16,10 @@
 	private double slope, xIntercept; 
 	private double direction;
-	private Planet destination;
+	private Planet destination, nearPlanet;
 	private int numShips;
 	private int faction;
 	private boolean isNextToAPlanet;
-	private boolean dirChanged, isClockwise;
+	private boolean isClockwise;
+	
 
 	/* Optimising: pre-calculate paths */
@@ -63,5 +64,4 @@
 		this.destination = destination;
 		this.isNextToAPlanet = false;
-		dirChanged = false;
 	}
 
@@ -175,7 +175,7 @@
 
 	public void update(ArrayList<Planet> planets) {
-		int speed = 1; //pixels per move
+		int speed = 3; //pixels per move
 		double distance, tangentDirection, angle;
-		Planet temp = null;
+		
 		//is the ship going around a planet already
 		if(!isNextToAPlanet){
@@ -186,10 +186,10 @@
 				distance = getDistanceBetween(dblX,dblY,p.getX(),p.getY());
 				if(distance <= p.radius){
-					temp = p;
+					nearPlanet = p;
 					break;
 				}
 			}
 			//if temp planet is not picked move along the direction by #speed
-			if(temp == null || dirChanged) {
+			if(nearPlanet == null) {
 				dblY += (Math.sin(direction)*speed);
 				dblX += (Math.cos(direction)*speed);
@@ -198,12 +198,18 @@
 				y = (int)dblY;
 			}else {				
-				double radAngle = Math.atan(getSlope(temp.getX(), temp.getY(), dblX, dblY));
+				if(nearPlanet == destination){
+					attack();
+					return;
+				} 
+				
+				double radAngle = Math.atan(getSlope(nearPlanet.getX(), nearPlanet.getY(), dblX, dblY));
 				//figure out which way to go clockwise or counter clockwise 
-				tangentDirection = (Math.atan(getSlope(temp.getX(),temp.getY(),dblX,dblY))) + (Math.PI/2);
+				tangentDirection = (Math.atan(getSlope(nearPlanet.getX(),nearPlanet.getY(),dblX,dblY))) + (Math.PI/2);
 				angle = Math.atan((Math.tan(tangentDirection) - Math.tan(direction))/(1 + Math.tan(tangentDirection)*Math.tan(direction)));
+				
 				if (angle <= Math.PI/2)
 					angle = Math.PI - angle;
 				
-				if(dblX < temp.getX())
+				if(dblX < nearPlanet.getX())
 					radAngle += Math.PI;
 				
@@ -216,11 +222,13 @@
 				else
 					isClockwise = true;
+				
 				if(Math.abs(diff)>Math.PI/2)
 					direction = angle-Math.PI;
 				else
 					direction = angle;
-					
-				dirChanged = true;
-				
+				
+				xIntercept = dblY - (dblX*Math.tan(direction));
+				
+				isNextToAPlanet = true;
 				//figure out which way to go clockwise or counter clockwise 
 				/*tangentDirection = (Math.atan(getSlope(temp.getX(),temp.getY(),dblX,dblY))) + (Math.PI/2);
@@ -235,18 +243,32 @@
 			//otherwise continue moving along the circumferenceds4
 			
-			
-			if(true){
-				
+			double dist = Math.abs(destination.getY() - (direction*destination.getY()) - xIntercept)/(double)Math.sqrt(Math.pow(direction,2)+1);
+			Log.i("Gencon", dist + " units");
+			if(dist < 5){
+				dblY += (Math.sin(direction)*speed);
+				dblX += (Math.cos(direction)*speed);
+
+				x = (int)dblX;
+				y = (int)dblY;
+				
+				if (getDistanceBetween(dblX,dblY,nearPlanet.getX(),nearPlanet.getY()) > nearPlanet.radius){
+					isNextToAPlanet = false;
+					nearPlanet = null;
+				}
 			} else {
-				angle = speed/temp.radius;
+				angle = speed/(double)nearPlanet.radius;
+				Log.i("Gencon", angle + "%");
 				if(isClockwise){
-					dblX = ((Math.cos(direction + (Math.PI/2) - angle)*(temp.radius) + temp.getX()));
-					dblY = ((Math.sin(direction + (Math.PI/2) - angle)*(temp.radius) + temp.getY()));
-					direction = direction - (Math.PI/2);
+					dblX = ((Math.cos(direction + (Math.PI/2) - angle)*(nearPlanet.radius) + nearPlanet.getX()));
+					dblY = ((Math.sin(direction + (Math.PI/2) - angle)*(nearPlanet.radius) + nearPlanet.getY()));
+					direction = direction - (angle*.4);
 				} else {
-					dblX = ((Math.cos(direction - (Math.PI/2) + angle)*(temp.radius) + temp.getX()));
-					dblY = ((Math.sin(direction - (Math.PI/2) + angle)*(temp.radius) + temp.getY()));
-					direction = direction + (Math.PI/2);
+					dblX = ((Math.cos(direction - (Math.PI/2) + angle)*(nearPlanet.radius) + nearPlanet.getX()));
+					dblY = ((Math.sin(direction - (Math.PI/2) + angle)*(nearPlanet.radius) + nearPlanet.getY()));
+					direction = direction + (angle*.4);
 				}
+				x = (int)dblX;
+				y = (int)dblY;
+				xIntercept = dblY - (dblX*Math.tan(direction));
 			}
 		}
@@ -256,5 +278,7 @@
 	//after the method is called the fleet needs to removed
 	public void attack() {
-		if(numShips <= destination.getNumShips()){
+		if(this.faction == destination.getFaction())
+			destination.setNumShips(destination.getNumShips() + numShips);
+		else if(numShips <= destination.getNumShips()){
 			destination.setNumShips(destination.getNumShips() - numShips);
 		} else {
@@ -262,4 +286,5 @@
 			destination.setFaction(this.faction);
 		}
+		this.numShips = 0;
 	}
 
