Results 1 to 3 of 3
Thread: Help with constructor?
- 07-07-2012, 11:30 PM #1
Member
- Join Date
- Jul 2012
- Posts
- 10
- Rep Power
- 0
Help with constructor?
Good Day,
///Looking error method defined already I'm getting on the --addRandomOrb
public class OrbWorld extends World
{
private static final int WIDTH = 800;
private static final int HEIGHT = 600;
private static final int FLOOR = 550;
private static final int ORBS = 10;
public OrbWorld()
{
super(WIDTH, HEIGHT, 1);
addRandomOrbs();
}
private void addRandomOrb() {
for (int i=0; i<ORBS; i++) {
addRandomOrb();
}
}
private void addRandomOrb() {
addOrb(Greenfoot.getRandomNumber(WIDTH), Greenfoot.getRandomNumber(FLOOR));
}
private void addOrb(int _x, int _y) {
addObject(new Orb(), _x, _y);
}
}Last edited by immortal; 07-08-2012 at 12:33 AM.
- 07-08-2012, 09:02 PM #2
Re: Help with constructor?
Why do they call it rush hour when nothing moves? - Robin Williams
- 07-09-2012, 11:20 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
What's a constructor?
By Army in forum New To JavaReplies: 3Last Post: 04-18-2012, 03:19 PM -
How to call a master constructor from a minor constructor?
By b.m in forum New To JavaReplies: 5Last Post: 12-14-2011, 01:47 PM -
What does this Constructor Do ?
By Ciwan in forum New To JavaReplies: 1Last Post: 10-02-2010, 06:24 PM -
Calling constructor of parent class from a constructor
By Java Tip in forum Java TipReplies: 0Last Post: 12-19-2007, 09:10 AM -
Calling constructor of same class from a constructor
By Java Tip in forum Java TipReplies: 0Last Post: 12-19-2007, 09:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks