Problems with scope of variables.
in
Programming Questions
•
2 years ago
I have a class called Bubble. I want to replace "i" in the "for" statement in my draw function with bubble size. Also I don't know what is supposed to be in the pair of parentheses in "Bubble myBubble = new Bubble();". As you can tell I don't really know anything: help!
- class Bubble{
- float bubbleSize;
- float centerX;
- float centerY;
- float cornerX = bubbleSize + centerX;
- float cornerY = bubbleSize + centerY;
- Bubble(){
- this.bubbleSize = bubbleSize;
- this.centerX = centerX;
- this.centerY = centerY;
- this.cornerX = cornerX;
- this.cornerY = cornerY;
- // for(bubbleSize=0;bubbleSize<60;bubbleSize++){
- ellipse(centerX,centerY,cornerX,cornerY);
- // }
- fill(255,150,150);
- }
- }
- void setup(){
- size(400,400);
- ellipseMode(CENTER);
- }
- void draw(){
- for(int i=0;i<10;i++;){
- Bubble myBubble = new Bubble();
- }
- }
1