ok thanks so have you heard of object oriented programming? Basically Java (which Processing is built on) is a language made for that.
You can check the basic tutorial on the Processing website about it :
The idea is to represent data in your code as logical objects.
Let’s take the example of a billiard ball : it has a location (x and y coordinated), a velocity (can be represented as a vector), a color… Those are attributes, it’s what define a billiard ball.
And you may want to create multiple balls in a billiard game, those are called objects. And those objects are variations of the same kind of entity : the Ball
class for example.
You can also make actions on your ball objects : apply a force, display them on the screen, change their color, position them… these are called methods
You can check a post I did on this subject (with balls also ) :
You will see that your code will be very structured and clear (because for now it’s hard to read) and it will be easier to add features (as the future trajectory or throw on click…)