Reputation: 155
I'm making a solar system simulator and I am having trouble moving the planets, the blue circle is supposed to circle the sun, however when I run my program nothing moves apart from constant flickering.
My code:
public class solar
{
public static void main(String args[])
{
while (true) {
SolarSystem x = new SolarSystem(500,500);
x.drawSolarObject(0,0,50,"YELLOW");
x.drawSolarObject(90,45,20,"BLUE");
x.finishedDrawing();
}
}
}
I have called methods from a class I am using, for example the drawSolarObject contains distance, angle, diameter, colour.
Any help would be greatly appreciated thanks.
Upvotes: 1
Views: 566
Reputation: 1322
Try this...
public class solar
{
public static void main(String args[])
int i = 0;
{
while (true) {
SolarSystem x = new SolarSystem(500,500);
x.drawSolarObject(0,0,50,"YELLOW");
x.drawSolarObject(90,i,20,"BLUE");
i++;
x.finishedDrawing();
}
}
}
Angle changes by one on each iteration.
Upvotes: 2