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