Hey, i have a problem in my game where the levels do not transitition, like from 1 to 2, and 2 to 3. I can get my ship to proceed to level 2, but after that it wont go to level 3. Can someone please help me figure this out this is my code to figure out what level i am currently on, and which level to proceed too based on that.
public int lvl=2;
public void checkLevel()
{
if (getY() == getWorld().getHeight()- getWorld().getHeight()+1)
{
if (lvl == 2)
{
getWorld().removeObject(this);
Greenfoot.setWorld(new doodleLVL2(this));
lvl =3;
}
else if (lvl ==3)
{
lvl =+1;
getWorld().removeObject(this);
Greenfoot.setWorld(new doodleLVL3Boss(this));
}
}
}