// 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; }
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; } } }
public void setLoc(Vector2D loc) { this.loc = loc; }