I have a class Pellets, it is the coordinates of the points of impact on the target and other supporting information.
In the program, I create an ArrayList<Pellets> and add hit points to it, but there is one problem - the center of the target.
In the program, I set the center of the target, this is the corresponding Pellets object, respectively, and my points of impact go to this center. Those. conditionally speaking, an array of Pellets is created in which the first element is the center of the target, and all the rest are already hits, but this is somehow not beautiful.
Please tell me how to implement in Java so that you can refer to this group like this:
Target.getCenter.getX <- выдает Х координату центра, Target.GetPellets(i).getX <- выдает Х координату попадания. public class Pellets { private int x, y, scale, size; private Color color; private int halfSize; Pellets(int xPellets, int yPellets, int scalePellets, int sizePellets, Color cPellets){ x = xPellets; y = yPellets; scale = scalePellets; size = sizePellets; color = cPellets; } public int getX(){ return x; } public int getY(){ return y; } public int getScale(){ return scale; } public int getSize(){ return size; } public Color getColor(){ return color; } public int getHalfSize() { halfSize = size / 2; return halfSize; } }