alright im having trouble getting this program to work correctly im sure its one of my equations but im not real good with trig and it works up to a point.
the goal: make a random number of dots that circle around a center point (int this case 250, 250) and stay at a constant distance from said point. each dot is to travel at different speeds.
this is my dot class which is activated by my gui class. there is a problem in advance somewhere and ive tried several different equations but this is the only one that produces any resutls.Code:import java.awt.Color;
import java.math.*;
import java.lang.*;
public class dots {
private double xposition;
private double yposition;
private double angle;
private double distance;
private double x;
private double y;
private double yChange;
private double xChange;
private Color color;
public dots()
{
reset();
}
public void reset()
{
xposition = (Math.random() * 400 + 1);
yposition = (Math.random() * 400 + 1);
color = new Color((int)(Math.random() * 256), (int)(Math.random() * 256), (int)(Math.random() * 256) );
xChange = (Math.random() * .0001);
yChange = (Math.random() * .0001);
x = 250 - xposition;
y = 250 - yposition;
distance = Math.sqrt((Math.pow(x, 2) + Math.pow(y, 2)));
}
public void advance()
{
x = 250 - xposition;
double a = x / distance;
angle = Math.acos(a);
xposition = 250 - (distance * Math.cos((angle - xChange)));
yposition = 250 - (distance * Math.sin((angle - yChange)));
System.out.println("angle: " + angle);
System.out.println("x pos: " + xposition);
System.out.println("y pos: " + yposition);
}
public Color getColor()
{
return color;
}
public int getX()
{
return (int)xposition;
}
public int getY()
{
return (int)yposition;
}
}
my problem is the dots all stop when they hit about the 9 o clock position, like they are hitting an invisible wall.
any help would be great! and i know my equations prob are very wrong. again not good at trig.

