Changes in / [9d030cb:38ac100] in galcon-client
- Location:
- src/com/example/helloandroid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/helloandroid/Fleet.java
r9d030cb r38ac100 264 264 } 265 265 } else { 266 angle = speed/(double)nearPlanet.radius ;266 angle = speed/(double)nearPlanet.radius*.1; 267 267 268 268 if(isClockwise){ -
src/com/example/helloandroid/GameView.java
r9d030cb r38ac100 131 131 public void run() { 132 132 while (mRun) { 133 //Log.i("Gencon", "run called"); 134 133 135 Canvas c = null; 134 136 try { 135 137 c = mSurfaceHolder.lockCanvas(null); 136 synchronized(mSurfaceHolder) { 137 if(mMode == STATE_RUNNING) 138 updatePhysics(); 138 synchronized (mSurfaceHolder) { 139 //Log.i("Gencon", "about to call stuff: mode is "+mMode); 140 141 if (mMode == STATE_RUNNING) updatePhysics(); 139 142 doDraw(c); 140 143 } … … 369 372 */ 370 373 private void updatePhysics() { 374 //Log.i("Gencon", "updatePhysics called"); 375 371 376 long now = System.currentTimeMillis(); 372 377 … … 375 380 // by 100ms or whatever. 376 381 if (mLastTime > now) return; 377 382 378 383 synchronized(planetsLock) { 379 384 for(Planet p : planets) { … … 394 399 } 395 400 396 mLastTime = now +50;401 mLastTime = now; 397 402 } 398 403 } -
src/com/example/helloandroid/Planet.java
r9d030cb r38ac100 11 11 public class Planet { 12 12 int radius; 13 int regenRate; // ships per second 13 14 private int x; 14 15 private int y; … … 17 18 boolean selected; 18 19 private Bitmap selection; 19 private int frameCount, framesUntilSpawn;20 20 21 21 public Planet(int radius, int x, int y) { … … 27 27 selected = false; 28 28 29 frameCount = 0; 30 framesUntilSpawn = 100/radius; 29 regenRate = 0; //change this to some expression / funcion call 31 30 32 31 int size = getRadius()+15; … … 133 132 134 133 public void update() { 135 if(faction != 0) { 136 frameCount++; 137 138 if(frameCount == framesUntilSpawn) { 139 frameCount = 0; 140 numShips++; 141 } 142 } 134 if(faction != 0) 135 numShips += radius/10; 136 143 137 } 144 138
Note:
See TracChangeset
for help on using the changeset viewer.