making a game and i want to make it so that when the player collects a certain number of objects it goes to the next level
// in the player class
private int coinNum;
// in act method
if(coinNum=5)
{
Greenfoot.setWorld(new next());
}if (coinNum == 5)
private int coinNum;
//in act method
Actor coin();
coin = setOneObjectAtOffset(0,0,Coin.class);
if(coin !=null)
{
Greenfoot.removeObject(Coin.class);
coinNum + 1;
}
if(coinNum==5)
{
Greenfoot.setWorld(new next());
}