Changeset 04a9a00 in galcon-client
- Timestamp:
- Jun 14, 2010, 1:07:33 AM (14 years ago)
- Branches:
- master
- Children:
- 9d030cb
- Parents:
- 647a312
- Location:
- src/com/example/helloandroid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/com/example/helloandroid/Fleet.java
r647a312 r04a9a00 248 248 } 249 249 } else { 250 angle = speed/(double)nearPlanet.radius *.1;250 angle = speed/(double)nearPlanet.radius; 251 251 252 252 if(isClockwise){ -
src/com/example/helloandroid/GameView.java
r647a312 r04a9a00 125 125 public void run() { 126 126 while (mRun) { 127 //Log.i("Gencon", "run called");128 129 127 Canvas c = null; 130 128 try { 131 129 c = mSurfaceHolder.lockCanvas(null); 132 synchronized (mSurfaceHolder) { 133 //Log.i("Gencon", "about to call stuff: mode is "+mMode); 134 135 if (mMode == STATE_RUNNING) updatePhysics(); 130 synchronized(mSurfaceHolder) { 131 if(mMode == STATE_RUNNING) 132 updatePhysics(); 136 133 doDraw(c); 137 134 } … … 351 348 */ 352 349 private void updatePhysics() { 353 //Log.i("Gencon", "updatePhysics called");354 355 350 long now = System.currentTimeMillis(); 356 351 … … 359 354 // by 100ms or whatever. 360 355 if (mLastTime > now) return; 361 356 362 357 synchronized(planetsLock) { 363 358 for(Planet p : planets) { … … 378 373 } 379 374 380 mLastTime = now ;375 mLastTime = now+50; 381 376 } 382 377 } -
src/com/example/helloandroid/Planet.java
r647a312 r04a9a00 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++; 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.