In my Java game, I've got a number of randomly-generated maps made of tiles. I'm struggling with writing the code to handle the entering/exiting of the maps.
Originally, I only had Ascend and Descend. Easy. Enter exit, arrive at entrance. Basically, I used depth-- and depth++. Start at level 1, descend to level 2. Ascend to level 1 if desired.
Now I have maps that have North, East, South, and West entrances. So when I exit North, I need to arrive at the South entrance. Similarly, when I enter East, I need to arrive at the West entrance.
I'm working on an elaboration of the Ascend/Descend --/++ system. This basically means I have to have code for:
eastEntrance sends player to westExit,
westEntrance sends player to eastExit,
northEntrance sends player to southExit,
southEntrance sends player to northExit.
westExit sends players to eastEntrance (etc for east, south, north).
This seems pretty cumbersome. What is a good way to link my maps?
I'd really appreciate any input on this.