Python语法的Rpg文本游戏

2024-03-29 15:14:43 发布

您现在位置:Python中文网/ 问答频道 /正文

以下是我的代码:

x = input ( "Hello what is your name : ")
print ("Nice to meet you " + x)
y = input ("Would you like to play Ted Ryan's Great Adventure Game? If you would like to play write yes if not write no : ")
if y == "yes": 
    a = input ("Okay you wake up in a white room with a clock, a door, and a shotgun and the door is locked. Write the corresponding letter to your choice. A.) You shoot the door down.  B.) Blow a whole in the wall. P.S. When writing your answer make sure the letters are capital. : ")
else:
    print ("Goodbye")
if a == "A":
    steptwo = input ("You find out that you are in a Nazi war camp. You know this because you are immediately greeted by a Nazi soldier. He tells you to go back in the room however you know you have at least one bullet left in the shotgun. Your choices are A.) Shoot the soldier  B.) Go back in the room. : ")
else: 
    stepthree = input ("Through the whole in the wall you see a fence with barb wire on top. The sky is so grey it is almost black and it is drizzling. You walk out of the whole. Next you see that two your left is the outside corner of the room you were in and to the right is a tower xonnected to the room you were just in with a ladder on it. Your choices are A.) Go left and turn the corner or B.) Go right and climb the ladder. : "
if steptwo == "A":
     stepfive = ("Luckily you were in a enclosed room with only the one soldier. The room is dimly lit and has two doors. Underneath one door you can see there is a light and you can hear the faint sound of people talking in German. From underneath the other door it is black and there is no sound of talking. : ")

由于某种原因,当我运行程序时,它告诉我有一个语法错误,它说if steptwo == "A":


Tags: andthetoinyouinputyourif