This site requires JavaScript, please enable it in your browser!
Greenfoot back
CaptainMorgan
CaptainMorgan wrote ...

2014/6/19

getWorld.addObject... help???

CaptainMorgan CaptainMorgan

2014/6/19

#
I'm trying to make a counter appear in a certain area using the getWorld.addObject, my code isn't working. Here's my code }
{
        if  (Number == 1)
        {
            if (Used_1 == 0)
            {
                Used_1 = 1;
                setImage (new GreenfootImage("27 - 26 ?", 46, Color.BLACK,Color.WHITE));
                Greenfoot.delay (120);
                world().addObject(new Counter() 28,28;
            }
        }
    }
It keeps saying " ')' expected after the (new Counter() part and I can't find a fix, someone help?
danpost danpost

2014/6/19

#
Look at line 9. 'world' is supposed to be 'getWorld' and there is no comma after 'new Counter()' and there is no closing parenthesis after the last '28'. Watch your syntax and spellings of method names.
CaptainMorgan CaptainMorgan

2014/6/20

#
I got replaced getWorld and forgot to change it back, but yeah thanks. It works now
You need to login to post a reply.