예제 #1
0
파일: star.cs 프로젝트: jiiehe/SpaceWars
        // 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;
        }
예제 #2
0
파일: star.cs 프로젝트: jiiehe/SpaceWars
 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;
         }
     }
 }
예제 #3
0
파일: star.cs 프로젝트: jiiehe/SpaceWars
 public void setLoc(Vector2D loc)
 {
     this.loc = loc;
 }