A for effort. Let me try that again.
what you're saying is basically it : i can only move rooms in cadence. Now if I added a second moveto instance, say
class room():
...
self.moveto2 = moveto2
entrance = room("You are in the entrance", 'door', door, entrance)
If i try to move from entrance to door, the error still says that I have not defined door. I'm assuming my entire logic and the way I'm using the class is wrong. I understand that technically door comes before entrance, so it sees currentRoom as being door and stops. Just not sure if I can make it keep going down the variable list as is to see the variable after the one that's used.
Now if I were to want to go from door to bedroom, let's say, I wouldn't be able to use a "back to previous room" function, so with my current layout that would be impossible to do?
what you're saying is basically it : i can only move rooms in cadence. Now if I added a second moveto instance, say
class room():
...
self.moveto2 = moveto2
entrance = room("You are in the entrance", 'door', door, entrance)
If i try to move from entrance to door, the error still says that I have not defined door. I'm assuming my entire logic and the way I'm using the class is wrong. I understand that technically door comes before entrance, so it sees currentRoom as being door and stops. Just not sure if I can make it keep going down the variable list as is to see the variable after the one that's used.
Now if I were to want to go from door to bedroom, let's say, I wouldn't be able to use a "back to previous room" function, so with my current layout that would be impossible to do?
class room(): def __init__(self, desc, exit, moveto): self.desc = desc self.exit = exit self.moveto = moveto door = room('You see a door', 'entrance', 1) entrance = room("You are in the entrance", 'door', door) hall = room('You are in the Hall', 'entrance', entrance) bedroom = room('You are in a bedroom', 'hall', hall) currentRoom = bedroom #End room definitions #Defintes function for and prints what you see on the screen def playerAction(): print(currentRoom.desc) print('Exits:', currentRoom.exit) print('************************') while True: playerAction() action = input('What do you do? >') #Defines what to do with the inputs if action == currentRoom.exit : currentRoom = currentRoom.moveto else : print('No')