I need some help to make it so that when the actor leaves a village, he spawns in the village entrance, rather than spawning all the way at the beginning.
This is the game.
Greenfoot.setWorld(new Outside());
public Outside()
{
//whatever you have here without spawning the main actor
}
public Outside(final int pos)
{
this();
switch(pos)
{
case 0: addObject(new MainActor(), getWidth()/2, 10); break;
case 1: addObject(new MainActor(), getWidth()-10, getHeight()/2); break;
case 2: addObject(new MainActor(), getWidth()/2, getHeight()-10); break;
case 3: addObject(new MainActor(), 10, getHeight()/2); break;
}
}Greenfoot.setWorld(new Outside(0));
public Outside()
{
this(0);
}
public Outside(int pos)
{
// whatever code you HAD in the main constructor
// plus the spawning code for the main actor
}