So I’ll jump right in with a question as my first post here…
Right after the short explanation: I’m trying to write a fairly simple mostly text RPG in the style of the old Fighting Fantasy game books. (http://en.wikipedia.org/wiki/Fighting_Fantasy for the unfamiliar.) And my current hurdle is setting up and running the areas .
So far I’m planning to have an Area class, of course, which will looks something like this:
public class Area{
private int areaNum;
private String descShort;
private String descLong;
private int[] exitDir;
private int[] exitNum;
private Creature mobType;
private int mobSize;
etc.
}
And getters for everything that is needed.
Next I think I need another class which consists of one big Object[][] and has all the data hard coded. That data is then accessed with getters that are called by the Area() constructor or the game loop when needed (unsure which yet). So each Area would initially be instantiated with only the areaNum(ber), ie.
Area areaOne = new Area(1);
and the constructor would do:
Area(int areaNum){
this.areaNum = areaNum;
this.getData(areaNum);
}
getData(int areaNum){
this.descShort = areaData.getDescShort(ereaNum);
this.descLong = areaDataa.getDescLong(areaNum);
etc.
}
And the Object[][] in areaData looks like this:
class AreaData {
Object[][] data = {
//there would be another area at index 0
{1, "Main Gate", "You approach the forbidding gate...", {2, 4}, {2, 0}, Goblin, 3},
{2, "Entrance Hall", "The air is thick with dust long undisturbed until...", {1, 2, 3, 4}, {3, 4, ,5 ,1}, null, 0},
{3, "North Hall", "You pass through a door leading north...", {1, 3}, {6, 2}, Orc, 2},
//continue for all areas
};
Does this make sense and am I coming at this from the right angle?
A lot of this is like me thinking out loud…
Any questions fire away. I don’t want to give unnecessary detail straight away.