Changeset 04a9a00 in galcon-client for src/com/example/helloandroid/Planet.java


Ignore:
Timestamp:
Jun 14, 2010, 1:07:33 AM (14 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
9d030cb
Parents:
647a312
Message:

Framerate is now set to 20 fps and planets spawn ships at different rates based on their size. However, fleets now don't leave a planet they're going around at the proper time.

File:
1 edited

Legend:

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

    r647a312 r04a9a00  
    1111public class Planet {
    1212        int radius;
    13         int regenRate;  // ships per second
    1413        private int x;
    1514        private int y;
     
    1817        boolean selected;
    1918        private Bitmap selection;
     19        private int frameCount, framesUntilSpawn;
    2020       
    2121        public Planet(int radius, int x, int y) {
     
    2727                selected = false;
    2828               
    29                 regenRate = 0;  //change this to some expression / funcion call
     29                frameCount = 0;
     30                framesUntilSpawn = 100/radius;
    3031               
    3132                int size = getRadius()+15;
     
    132133       
    133134        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                }
    137143        }
    138144       
Note: See TracChangeset for help on using the changeset viewer.