I am facing another problem with my next “project”.
I have classes for different rooms. In each one I defined a function
which basically performs everything in the room. The player moves
through the rooms.
Here are my problems:
- Connecting the rooms
I can kick everything off in a separate file (the runner) where I create
the first room and then pass the following room as the argument. I also
create other rooms in this separate files. But in the second room
everything crashes, because any of the rooms that could follow are
basically unrecognized as the local variables.
The other option is to create the following room when needed, that is in
the existing room. However, that would pose the problem because the
newly created would again have limited existence to one room.
Of course there is also the issue of returning to a room which was
I am doing this as a task in the book learning ruby the hard way by Zed.
Maybe I’ve made a mistake for trying to put everything in the room
classes and not just the room descriptions.
Anyway, I maintain the code here:
I would appreciate any pointers. I am stuck. I still have a lot of work
to do with various descriptions and particular activities in rooms, but
the main problem is this room connection.