Changeset 9d030cb in galcon-client for src/com/example/helloandroid/Fleet.java
- Timestamp:
- Jun 14, 2010, 1:19:14 AM (14 years ago)
- Branches:
- master
- Children:
- 3a0d468
- Parents:
- 04a9a00 (diff), 38ac100 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/helloandroid/Fleet.java
r04a9a00 r9d030cb 22 22 private boolean isClockwise; 23 23 24 /* Optimi sing: pre-calculate paths */24 /* Optimizing: pre-calculate paths */ 25 25 public Fleet(Planet source, Planet destination, int numShips, int faction) { 26 26 source.setNumShips(source.getNumShips()-numShips); … … 236 236 237 237 double dist = Math.abs(destination.getY() - (Math.tan(direction)*destination.getX()) - xIntercept)/(double)Math.sqrt(Math.pow(direction,2)+1); 238 if(dist < 2){ 238 int allowedError = 2; 239 if(nearPlanet.radius <= 10) 240 allowedError = 10; 241 else if(nearPlanet.radius <= 30) 242 allowedError = 5; 243 if(dist < allowedError){ 239 244 dblY += (Math.sin(direction)*speed); 240 245 dblX += (Math.cos(direction)*speed); … … 246 251 isNextToAPlanet = false; 247 252 nearPlanet = null; 253 254 slope = getSlope(x,y,destination.getX(),destination.getY()); 255 256 xIntercept = destination.getY() - (slope*destination.getX()); 257 258 //direction 259 direction = Math.atan(slope); 260 261 //coordinates for all 4 coordinates 262 if((destination.getX() - x) < 0 ) 263 direction += Math.PI; 248 264 } 249 265 } else {
Note:
See TracChangeset
for help on using the changeset viewer.