Changeset 012e702 in galcon-client for src


Ignore:
Timestamp:
Jun 8, 2010, 2:02:51 AM (14 years ago)
Author:
Zero Cool <devnull@…>
Branches:
master
Children:
38ac100
Parents:
647a312
Message:

Let's hope the ships do not turn around cause if they randomly do it is this commit that we need to fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/example/helloandroid/Fleet.java

    r647a312 r012e702  
    236236                       
    237237                        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){
    239244                                dblY += (Math.sin(direction)*speed);
    240245                                dblX += (Math.cos(direction)*speed);
     
    246251                                        isNextToAPlanet = false;
    247252                                        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;
    248264                                }
    249265                        } else {
Note: See TracChangeset for help on using the changeset viewer.