Ejemplo n.º 1
0
        // constructor to intilize the field data of the star
        public star(int ID, Vector2D loc, double mass)
        {
            this.ID   = ID;
            this.loc  = loc;
            this.mass = mass;

            this.lastUpdate = 0;
        }
Ejemplo n.º 2
0
 public void update(int time)
 {
     //this.loc = this.loc + new Vector2D(0.08, 0.08);
     if (time - lastUpdate > 50)
     {
         lastUpdate = time;
         if (this.loc.GetX() == 0 && this.loc.GetY() == 0)
         {
             this.loc = new Vector2D(0, -200);
             return;
         }
         if (this.loc.GetX() == 0 && this.loc.GetY() == -200)
         {
             this.loc = new Vector2D(-200, -200);
             return;
         }
         if (this.loc.GetX() == -200 && this.loc.GetY() == -200)
         {
             this.loc = new Vector2D(-200, 200);
             return;
         }
         if (this.loc.GetX() == -200 && this.loc.GetY() == 200)
         {
             this.loc = new Vector2D(200, 200);
             return;
         }
         if (this.loc.GetX() == 200 && this.loc.GetY() == 200)
         {
             this.loc = new Vector2D(200, -200);
             return;
         }
         if (this.loc.GetX() == 200 && this.loc.GetY() == -200)
         {
             this.loc = new Vector2D(-200, -200);
             return;
         }
     }
 }
Ejemplo n.º 3
0
 public void setLoc(Vector2D loc)
 {
     this.loc = loc;
 }