我正在制作一个随机的生存游戏

时间:2017-11-08 19:36:28

标签: python

player_health = 100
variable_shelter = "0"
variable_water_goodoutcome = "0"
variable_water_badoutcome = "-100"
variable_food_goodoutcome = "0"
variable_food_badoutcome = "-100"
var_a = 0
var_b = 1

user_answer_1 = "fire"
user_answer_2 = "water"
user_answer_3 = "shelter"
user_answer_4 = "food"
name_input = input("Hello! Welcome to Survival Scenarios! What is your 
Name?")

question1_input = input("You are stranded on an island after your plane 
crashed.You have little time before nightfall. For your survival you 
have the choice of finding or building food, water, shelter, or fire. 
What is you choice?")

if question1_input == user_answer_1:
    import random 
    variable_fire_goodoutcome = 0
    variable_fire_badoutcome = 100
    var_choice1 = [variable_fire_goodoutcome,variable_fire_badoutcome]
    var_chances = random.randint(var_a,var_b)

if var_chances == variable_fire_goodoutcome:
    print(name_input +"'s" " Health")
    print[player_health - variable_fire_goodoutcome]

if var_chances != variable_fire_goodoutcome:
    print(name_input +"'s" " Health")
    print[player_health - variable_fire_badoutcome]
    print("Sorry you died")

稍后添加他们死亡的信息

if question1_input == user_answer_2:
    import random
    variable_water_goodoutcome = 0 
    variable_water_badoutcome = 100
    var_choice2 =[variable_water_goodoutcome,variable_water_badoutcome]
    var_chances1 = random.randit(var_a,var_b)

if var_chances1 == variable_water_goodoutcome:
    print(name_input +"'s"" Health")
    print[player_health - variable_water_goodoutcome]

if var_chances1 != variable_water_goodoutcome:
    print(name_input +"'s"" Health")
    print[player_health - variable_water_badoutcome]

不断出现此错误: NameError:name' var_chances'没有在第29行定义 如果有人可以请求帮助,将不胜感激。

0 个答案:

没有答案