Hello I am new to python and this is my first stack overflow post, so I apologize if this question has been answered elsewhere (I'm not entirely sure how to search for this topic, feel free to drop a link if it is).
I'm creating an adventure game and I want the user to choose different paths within a house.
I want the user to be able to travel back and forth between room A and room B, however I want different dialogue to appear based on how many times a user has entered room A or room B. If its the first time, I want the function to print (option 1), but if the user enters >1 time i want the function to print (option 2)
I've figured out how to travel back and forth between the 2 rooms, but I don't get different dialogue options if I enter either room >1 times with my current increment code. Does it have to do with the fact that I exit the room_A function when i 'travel to room_B'?
Any help would be greatly appreciated!
def room_A():
room_A_count = 0
# - if this is the first time the user enters the room, this code runs...
if room_A_count == 0:
print ("You enter room A")
print ("What would you like to do?")
print ("1. Enter room B")
print ("2. nothing")
room_A_choice = input("Choice: ")
if room_A_choice = "1":
room_A_count += 1
# - travel to room B
room_B()
elif room_A_choice == "2":
print ("You do nothing")
# - if the user travels back from Room B to Room A, it prints this message...
else:
print ("You enter room A again")