This site requires JavaScript, please enable it in your browser!
Greenfoot back
Minion1
Minion1 wrote ...

2012/12/22

Making a world map.

1
2
danpost danpost

2012/12/22

#
There really is no problem with clearing the world. If in the hero class:
World world=getWorld();
int heroX=getX(), heroY=getY();
world.removeObjects(getObjects(null));
//  call method to create new area
world.addObject(this, heroX, heroY);
This saves the location of the hero and saves a reference to the world; then removes all objects, creates the new area and re-inserts the hero at the same location it was removed from.
You need to login to post a reply.
1
2