Hello,
I have created a sketch based on this one:
http://processing.org/learning/topics/bouncybubbles.html
In my sketch there is no gravity, and the bubbles just bounce against each other. I gave them properties such as color, size, and type. The bubbles affect each other on either collision or when they get close to one another. A "suckR" type bubble will "suck" the red (hence "suckR") of the bubbles within a certain distance. I created several types like this, affecting color or size. It's very beautiful to look at but it's not the point :)
So, I have only one class with a "type" variable that defines which method will be used when the bubble approaches another one. The idea being to give randomness a bigger part in the process, I would like to create one class per type instead of one class with "switchable" methods. I would like to define in each class which variables can be affected by other bubbles, and that's what I don't know how to do. I want to be able to create new classes without having to update each previously created class to tell them which variables from the new class can be affected. If I'm not mistaken, Processing doesn't allow to access variables dynamically so I can't just name the variables in an array. I'm sure it's not such a complicated thing for experienced coders but I'm a self-taught stupid amateur and feel stuck! Please help, I need a hint!
I hope I made myself clear enough, English not being my mother tongue, thanks in advance for any help!
1