basic object question
in
Programming Questions
•
3 years ago
i used to programm in flash, and i am new to processing.
my main-understanding-question in processing is:
if i create objects to the stage, how can i call them? (like instances)
for example i have a array of objects like this:
- int numSpots = 10;
- Spot[] spots = new Spot[numSpots];
- void setup() {
- size(450,150);
- smooth();
- background(0);
- for (int i = 0; i < spots.length; i++) {
- float x = (40 + 5)*i;
- spots[i] = new Spot(x);
- }
- }
- class Spot {
- float x;
- Spot(float xpos) {
- x = xpos;
- fill(255,10);
- rect(x, 0, 40, 150);
- }
- }
like this:
- print("im over" + i);
1