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

2013/6/5

changing levels

rachel1495 rachel1495

2013/6/5

#
I want the game to change levels once all the blue balloons are gone. I have this but it doesn't work. How can I change to the next level? public void nextLevel() { Object balloon = getIntersectingObjects(Balloon2.class); if(balloon==null) { BalloonWorld world = (BalloonWorld)getWorld(); world.Level2(); } }
Gevater_Tod4711 Gevater_Tod4711

2013/6/5

#
InsteadOf Object balloon = ... you should use
if (getWorld().getObjects(Balloon2.class).isEmpty()) {
    BalloonWorld world = (BalloonWorld)getWorld();
    world.Level2();
}
You need to login to post a reply.