Hello everybody !
Let 's start by a quick présentation because this is my first post.
I am learning slowly Java and i have start by processing there is a month and a half.
I achieved a game with 2 balls, each  jumping and hitting the other, in processing.
A friend of mine is coaching me and ask me to start Object way to think… so i have refactorise my code.
That where troubles begun…
I have try to import ArrayList and ListIterator… and finally i have load processing.core as a library in my project.
I have already read a lot about this. Here a skeleton of my code.
import processing.core.PApplet;
public class MainClass extends PApplet {
    public static PApplet p;
    public static Game game;
        public static void main (String... args) {
            PApplet.main("MainClass", args);
            game = new Game();
        }
    public void settings(){
            p = this;
        smooth(); // Lissage des dessins
        size(800,400);
    }
    public void draw(){
        //background(0,0,0);// On dessine un fond noir
        noStroke(); // on supprime le contour
        ellipse(400,200,40,40);
        ellipse(300,50,40,40);
        game.player01.ball.display();
        game.player02.ball.display();
        }
}
public class Game {
    public static Player player01;
    public static Player player02;
    public Game(){
        generatePlayer();
        }
    void generatePlayer(){
        player01= new Player("Helron",255,100,200);
        player02= new Player("Nico",125,200,100);
    }
}
import java.awt.*;
public class Player {
    String name;
    int nbColor;
    int score;
    int startXcoordonate;
    int startYcoordonate;
    Point startPosition;
//    String upButton;
//    String downButton;
//    String rightButton;
//    String leftButton;
//    String hitButton;
    public static Ball ball;
    Player (String name, int nbColor, int startXcoordonate, int startYcoordonate){
        this.name = name;
        this.nbColor = nbColor;
        this.startXcoordonate = startXcoordonate;
        this.startYcoordonate = startYcoordonate;
        score = 0;
        startPosition = new Point(startXcoordonate, startYcoordonate);
        generateBall(startPosition);
    }
    void generateBall( Point startPosition){
        ball = new Ball(MainClass.p.color(nbColor), startPosition);
    }
}
import java.awt.*;
public class Ball {
    int color;
    Point actualPosition;
    //Constructeur de la balle
    Ball (int color, Point actualPosition) {
        this.color    = color;
        this.actualPosition = actualPosition;
    }
    //Dessin de la balle
    public void display() {
        MainClass.p.fill(MainClass.p.color(color));
        MainClass.p.ellipse(actualPosition.x, actualPosition.y, 40, 40);
    }
}
So here my problem… : i should have 4 balls… two of them are test, the other ones should be write and gray… and even if i comment game.player01.ball or game.player02.ball i still have a identical ball display.
Some how i am asking the draw 2 times the same thing… and i have no clue how to fix this.
Does somebody could help me please ?
