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

2014/3/17

Ending the game

Tarasovych Tarasovych

2014/3/17

#
How can I end the game, when counter gets nuber X and after than the world image will change?
danpost danpost

2014/3/17

#
Do you want something like (from an actor class):
if (counter == X)
{
    getWorld().setBackground(/* new background image */);
    getWorld().removeObjects(getWorld().getObjects(null));
    Greenfoot.stop();
}
Tarasovych Tarasovych

2014/3/17

#
danpost wrote...
Do you want something like (from an actor class):
if (counter == X)
{
    getWorld().removeObjects(getWorld().getObjects(null));
    getWorld().setBackground(/* new background image */);
    Greenfoot.stop();
}
cannot find symbol - variable Counter
danpost danpost

2014/3/17

#
Tarasovych wrote...
when counter gets nuber X
danpost wrote...
something like
Tarasovych Tarasovych

2014/3/17

#
java.lang.NullPointerException at Counter.act(Counter.java:75) What can I do with that?
danpost danpost

2014/3/17

#
Show the method of your Counter class that has line 75 in it.
Tarasovych Tarasovych

2014/3/17

#
danpost wrote...
Show the method of your Counter class that has line 75 in it.
getWorld().setBackground("end.png");
danpost danpost

2014/3/17

#
Make that line the first line in the 'if' block (I had edited my code post above -- take a look).
Tarasovych Tarasovych

2014/3/17

#
danpost wrote...
Make that line the first line in the 'if' block (I had edited my code post above -- take a look).
THANK YOU VERY MUCH!
You need to login to post a reply.