Results 1 to 3 of 3
  1. #1
    immortal is offline Member
    Join Date
    Jul 2012
    Posts
    10
    Rep Power
    0

    Question 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 01:33 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Help with constructor?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help with constructor?

    What error are you getting (in full) and the line it is occurring on.
    Also please use code tags when posting code.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. What's a constructor?
    By Army in forum New To Java
    Replies: 3
    Last Post: 04-18-2012, 04:19 PM
  2. Replies: 5
    Last Post: 12-14-2011, 02:47 PM
  3. What does this Constructor Do ?
    By Ciwan in forum New To Java
    Replies: 1
    Last Post: 10-02-2010, 07:24 PM
  4. Replies: 0
    Last Post: 12-19-2007, 10:10 AM
  5. Replies: 0
    Last Post: 12-19-2007, 10:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •