Changeset 1a91f0d in galcon-client
- Timestamp:
- May 28, 2010, 12:34:15 AM (14 years ago)
- Branches:
- master
- Children:
- 3e9f39e
- Parents:
- 96857ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/helloandroid/Fleet.java
r96857ee r1a91f0d 15 15 public Fleet(Planet source, Planet destination, int numShips, int faction) { 16 16 //Calculate initial coordinates and direction 17 17 if(destination.x - source.x != 0){ 18 18 //line formula 19 19 slope = ((source.y - destination.y)/(source.x - destination.x)); … … 24 24 25 25 //coordinates for all 4 coordinates 26 if ((direction >= 0) && (direction < Math.PI/2)){ 27 x = (int)(Math.cos(direction)*(source.radius + 10) + source.x ); 28 y = (int)(Math.sin(direction)*(source.radius + 10) + source.y ); 29 } else if((direction >= Math.PI/2) && (direction < Math.PI)){ 30 31 } else if((direction >= Math.PI) && (direction < 3*Math.PI/2)){ 26 if(destination.x - source.x < 0 ) 27 direction += Math.PI; 32 28 29 x = (int)((Math.cos(direction)*(source.radius + 10) + source.x)); 30 y = (int)((Math.sin(direction)*(source.radius + 10) + source.y)); 33 31 } else { 32 if((destination.y - source.y) > 0 ){ 33 direction = Math.PI/2; 34 x = destination.x; 35 y = source.y + source.radius + 10; 36 } else { 37 direction = 3*Math.PI/2; 38 x = destination.x; 39 y = source.y - source.radius - 10; 40 } 41 } 34 42 35 }36 43 this.numShips = numShips; 37 44 this.faction = faction; … … 113 120 114 121 public void update() { 115 //update coordinates 116 122 117 123 } 118 124 119 125 // attack the destination planet 120 126 public void attack() { 121 //planet attack 127 if(numShips <= destination.numShips ){ 128 129 } 122 130 } 123 131 }
Note:
See TracChangeset
for help on using the changeset viewer.