I want to make a method that when my player reaches the top edge of the world, he changes worlds and the player "respawns" at the location i want....
I've got this so far:
He changes the world and spawn the player but somehow the setLocation() doesnt work
public void playerChangeWorld()
{
if (getY() == 0)
{
if (getWorld() instanceof World1)
{
Greenfoot.setWorld(new World2());
setLocation(500,500);
}
}
if (getY() == 799)
{
if (getWorld() instanceof World2)
{
Greenfoot.setWorld(new World1());
setLocation(500,500);
}
}
}

