Hello everyone I was wondering if someone can help me out here. I'm working on a scenario involving bubbles, if you have the book it is Chapter 6 pg. 121. I am working on the part where I am supposed to increase the bubbles that are running horizontal by 10 in some sort of loop until it stops at 100 starting at 10 for the first bubble, 20, 30, 40, etc. I feel like i know what to do but everything i have tried does not work.
int x = 0; is where the horizontal line starts so if anyone can help me out that would be great
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* A bit of empty space for bubbles to float in.
*
* @author Michael Kölling
* @version 1.0
*/
public class Space extends World
{
/**
* Create Space. Make it black.
*/
public Space()
{
super(900, 600, 1);
getBackground().setColor(Color.BLACK);
getBackground().fill();
setup();
}
private void setup ()
{
Bubble[] bubble = new Bubble[21];
int i = 0;
while (i < bubble.length)
{
bubble[i] = new Bubble();
addObject(bubble[i], i*45, i*30);
i++;
}
int x = 0;
while ( x < 10 )
{
addObject(new Bubble(),300 + x +40, 100);
x = x + 1;
}
