According to Processing's documentation, you can append an array of objects the same way, as you append any other array. I'm doing exactly that, but I get an error:
cannot convert from Object to sketch_220416a.planet[]
Here is a minimal, reproducible example:
planet[] PLANETS = new planet[1];
void setup() {
PLANETS[0] = new planet(100, 10, 10);
planet tb = new planet(200,3,1);
PLANETS = append(PLANETS, tb);
size(800, 800);
}
class planet{
planet(float r, float x, float y)
{
}
/*Some code*/
}