Timeline for Movement in a text-based game using room class (Python)
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 11, 2017 at 13:26 | vote | accept | Schrodinger'sStat | ||
| Jul 11, 2017 at 13:18 | vote | accept | Schrodinger'sStat | ||
| Jul 11, 2017 at 13:26 | |||||
| Jul 7, 2017 at 22:08 | comment | added | Orren Ravid | that's fair. Your approach does provide a greater flexibility. Since OP didn't specify what sort of navigation he was looking for, I suggested the 2D array as a possibility, which I believe OP as a beginner should consider while also considering its shortcomings as you mentioned. | |
| Jul 7, 2017 at 21:57 | comment | added | Jimmy | @orrendavid I considered that but most of the MUD's i've played have had highly irregular map layouts (rooms with interiors larger than exteriors, vertical portals, passages with less cells on the way down than on the way up, etc) that would be very hard to shoehorn into a 2D array. I find the exit-links strategy much more flexible. | |
| Jul 7, 2017 at 21:38 | comment | added | Orren Ravid | Good answer. However, I might add that you can also do something like a 2D list storing the rooms. Since the player can move North, South, East, and West, and each index of the array is in the form of list[i][j], you simply increment i to move East, decrement i to move West, increment j to move North and decrement j to move South. You may run into problems if your entire list isn't populated with rooms but that can easily be solved by checking if a given index isn't empty before allowing the user to go there. | |
| Jul 7, 2017 at 20:06 | history | answered | Jimmy | CC BY-SA 3.0 |