When I get the Hero to the 'exit' point of the map - how do I get it to read the next portion of the map?
private void moveMap()
{
CreateMap C = (CreateMap)getWorld();
if (C.MapLevel == 0 && getX() >= 200 && getY() <= 0)
{
C.MapLevel = (C.MapLevel+1);
Greenfoot.setWorld(new CreateMap(C.MapLevel));
}
else if (C.MapLevel == 1 && getX() >= 211 && getY() >= 328)
{
C.MapLevel = (C.MapLevel-1);
Greenfoot.setWorld(new CreateMap(C.MapLevel));
}
}public void addMapSpecificObjects()
{
Hero = new Hero();
if (MapLevel == 0)
{
addObject(Hero, 206, 87);
}
if (MapLevel == 2)
{
addObject(Hero, 211, 312);
}
}CreateMap C2 = new CreateMap(C.MapLevel); // gets reference to new world C2.Hero.setLocation(/* wherever */); // relocates hero in new world Greenfoot.setWorld(C2); // sets new world active