我正在创建一个基于文本的rpg,我需要弄清楚如何对其执行循环,这样我才能回到它们进行的主要故事图块。我需要将Map循环回选项部分。
story = input("What do you do? your choices -> Map, Travel, Exit")
if story == "Exit":
print("you left the game, goodbye" + " " + Name + "!")
import sys
sys.exit()
if story == "Map":
print("Your map shows an abandoned house, Lake, Lab, and abandon asylum.")
答案 0 :(得分:0)
我不太确定你的意思,也许是这样的东西?
while True:
story = input("What do you do? your choices -> Map, Travel, Exit")
if story == "Exit":
print("you left the game, goodbye" + " " + Name + "!")
import sys
sys.exit()
if story == "Map":
print("Your map shows an abandoned house, Lake, Lab, and abandon asylum.")
我个人还是会做一些改动:
import sys
while True:
story = input("What do you do? your choices are: Map, Travel, Exit").lower()
if story == "exit":
print("you left the game, goodbye {}!".format(Name))
sys.exit()
elif story == "map":
print("Your map shows an abandoned house, lake, lab, and abandoned asylum.")