Hi everybody,
I guess my title says it all. I need a code for this, but I can't figure it out myself.
To be short, this is my question.
If between certain coordinates then: next level
If not, stay in same level
if (getX()>/*...*/&&getX()</*...*/&&getY() /*...*/&&getY()</*...*/)
{ //add the coordinates ↑
Greenfoot.setWorld(new Level(level+1)); //or however you do it
}public void finish()
{ if (getX()>861 &&getX()<963 &&getY()>100 &&getY()<200)
//add the coordinates ↑
Greenfoot.setWorld(new Level2()); //or however you do it public void act()
{
getDirection();
move();
if (getX()>861 &&getX()<963 &&getY()>100 &&getY()<200 &&(Actor.Player2 (getX()>861 &&getX()<963 &&getY()>100 &&getY()<200)))
//add the coordinates ↑
Greenfoot.setWorld(new Level1()); //or however you do it
}public void act()
{
getDirection();
move();
}public boolean atFinish()
{
return getX() > 861 && getX() < 963 && getY() > 100 && getY() < 200;
}if (player1.atFinish() && player2.atFinish()) Greenfoot.setLevel(new Level2());
atFinish finish = new atFinish()
if(atFinish())
if(finish())