First I had a problem, that if i caught one ball, that all balls disappears on the field. I fixed that by using a method. For example if I caught one ball, that ball will go to another ball. And the problem that I have now is that the points also goes to the other ball. And the points on that ball will be much higher than 5 points.
I hope you understand something:)
One note: I know that the last ball gives you the points all the time
My Code:
int windowBreedte = 500;
int windowHoogte = 500;
int snelheidKarel = 10; // Speed Triangle
int score = 0;
float middenpuntDriehoekX; //center Triangle X
float middenpuntDriehoekY; //center Triangle Y
int index = 10; // How much balls on field
int [][] balletjes = new int [index][3]; // Array for making the balls
int balGrootteX = windowBreedte / 30; // diameter ball X
int balGrootteY = windowHoogte / 30; // diameter ball Y
boolean ballen = true;
int triangleX = int (random(windowBreedte / 20 + (windowBreedte / 20), (windowBreedte - (windowBreedte / 20)) - (windowBreedte / 20))); // random position triangle X
int triangleY = int (random(windowHoogte / 20 + (windowHoogte / 20), (windowHoogte - (windowHoogte / 20)) - (windowHoogte / 20))); // randomPosition triangle Y