Basic Java global variable question

Aha! I think there is maybe some confusion about what I’m trying to do, which is understandable since I’m still new at this. So maybe I should try to explain better what I’m trying to do.

I’m trying to create an array of objects (bubbles). Every frame, I want the color of each bubble to be incremented a small amount, and the bubble to be redrawn. So I need the list of objects and the color data they contain to remain global.

When I change the bubbles from being added in setup to being added in draw, for example, it allows the bubbles to be redrawn every frame, however it gives each object its own RGB list. I want the RGB list to be global so each object can draw from it. So I need the list of objects to be created only once, and use a global RGB list, but update and re-draw every frame.

Sorry for being so long-winded. Variable scope is still difficult for me to wrap my head around sometimes!

1 Like