How do i make levels for my game?
Greenfoot.setWorld(new MyWorld2); //Replace MyWorld2 with whatever you next level name is.
public void tryToEat() { if( canSee(Fly.class)) { eat(Fly.class); counter.add(50); } if( canSee(Coin.class)) { eat(Coin.class); counter.add(10); } if( canSee(Ant.class)) { eat(Ant.class); counter.add(100); } if( canSee(Spider.class)) { eat(Spider.class); counter.add(200); } if (counter.getValue() >= 5000) { GameOver(); } } public void GameOver() { Greenfoot.stop(); } public void Game() { if (GameOver) { Greenfoot.setWorld(new Two); } }
Greenfoot.setWorld(new Two);
Greenfoot.setWorld(new Two()); //with the parentheses
public void tryToEat() { if( canSee(Fly.class)) { eat(Fly.class); counter.add(50); } if( canSee(Coin.class)) { eat(Coin.class); counter.add(10); } if( canSee(Ant.class)) { eat(Ant.class); counter.add(100); } if( canSee(Spider.class)) { eat(Spider.class); counter.add(200); } if (counter.getValue() >= 500) { GameOver(); } } public void GameOver() { Greenfoot.stop(); Greenfoot.setWorld(new Two()); }