I want my Actor 'haai' to proceed to the next level 'level2' when my 'haai' is at the coordinates of 56, 30. But I don't know how to translate this into code. Here is my code for proceeding to the next level:
private void checkNextLevel()
{
if (haai(57,30)) // Here is the fault, and I think here should come to code for my 'haai' to be at that place and then proceed.
{
if (level == 1) {
level = 2;
getWorld().removeObject(this);
Greenfoot.setWorld(new level2(this));
}
else {
level = 1;
getWorld().removeObject(this);
Greenfoot.setWorld(new wereld(this));
}
}
}