I'm trying to make a basic text RPG game, and I have just started. I am currently working on a menu, but whenever I try and enter 'p', it goes back to the menu, unintentionally. I want my program to not go back to the menu, and keep staying on the play bit, where the game will actually happen.
Here is my code that reproduces the error:
running = True
def menu(): #Game menu
print("")
print("FROM SUNSTEEL - MENU")
print("")
print("")
print("enter 'p' to play")
print("")
print("enter 'c' to view game credits")
print("")
print("enter 'q' to exit the game")
print("")
user_menuinput = input()
if user_menuinput == 'p':
play()
if user_menuinput == 'q':
time.sleep(0.5)
print("Quitting game...")
quit()
if user_menuinput == 'c':
time.sleep(0.5)
for i in range (3):
print("")
print("From Sunsteel was programmed by Dusco_11, with some help from Alex_Sour")
for i in range (3):
print("")
menu()
if user_menuinput != 'p' or 'q':
print("Invalid awnser, returning to menu.")
menu()
def play(): # Actually plays the game :o
for i in range(3):
print("")
print("FROM SUNSTEEL")
time.sleep(1)
chapter1()
def chapter1(): # From Sunsteel Chapter 1
for i in range(3):
print("")
print("CHAPTER 1: DUSCOLIA'S FINAL FRONTIER")
while running == True: # Game loop
menu()
I think it is an issue with this line:
if user_menuinput != 'p' or 'q':
print("Invalid awnser, returning to menu.")
menu()
I have tried looking up my issue on other sites, however I haven't found any good solutions. Any help would be appreciated, thanks.