I've been making a text-based game to practice
Java. Basically the player moves around a 2-D grid and different stuff happens on each space.
I keep track of where the player is using row and column values. I then feed those values to a method to make whatever is supposed to happen on a particular space happen.
All sorts of different things might happen on a space. The player might fight a monster, have a dialogue, or there might be nothing there. To complicate things further different things might happen different times a the player moves onto a space (random).
However, the grid has 36 spaces so that is a lot of if statements. ie: if row = 0 & column = 0 ; if row = 0 & column = 1; ........... if row = 5 & column = 5. So, this will end up being a really long-winded method.
Here is an example of what some of the code looks like right now:
I'm pretty new to Java and just trying to learn the most conventional/cleanest way to do things. I'm fine having a huge long list of if statements but I don't want to show this to a professor or employer and have them tell me how foolish I was to do it that way, hah.
Thanks for any help or suggestions.