This site requires JavaScript, please enable it in your browser!
Greenfoot back
dbutts1@stumail.com
dbutts1@stumail.com wrote ...

2017/12/15

Bubbles with a for loop

dbutts1@stumail.com dbutts1@stumail.com

2017/12/15

#
I am trying to use a for loop instead of a while loop and am running into the message cannot find symbol -class bubble This is set up pretty much like my while loop, so I do not understand the message "cannot find symbol -class bubble" Here is my code import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * 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(); int i = 0; for( i=0;(i <+21); i++) { addObject(bubble=new bubble(),i*30,i*30); } } }
danpost danpost

2017/12/15

#
The class is named 'Bubble' -- not 'bubble'. You create an object from a class using the class name. So, it is not 'new bubble()', but 'new Bubble()' which you should be using.
dbutts1@stumail.com dbutts1@stumail.com

2017/12/15

#
Thank You
You need to login to post a reply.