Hey everyone!
I'm working on a roguelike project, but I'm still pretty inexperienced as a programmer, so I thought I would ask for advice on this.
How should I connect the stairs in different floors with each other? I'm going to have persistent levels and sometimes the dungeons will have branching paths, so I can't just have a depth variable that I add or subtract 1 from. The best thing I can come up with is by making each floor its own subclass of the stage class, something like this:
class Tower1 extends Stage {
Tower1() {
int numberOfStairs = 2;
stairs[0] = worldMap;
stairs[1] = tower2;
}
}
class Tower2 extends Stage {
Tower2() {
int numberOfStairs = 3;
stairs[0] = tower1
stairs[1] = tower3;
stairs[2] = tower4;
}
}
worldMap, tower1, tower2, etc would all be constant variables for referencing each map.
Oh, and I'm using Java if that makes a difference.