绝对是初学者。我正在做一个文本冒险游戏,以提高初学者的技能。有人能给我举个例子,说明我的生活中会发生什么吗 “def firstBattle”,功能?你知道吗
比如一个小的战斗例子,更新统计和库存?谢谢
def displayIntro():
# I will update this as I think of more to add
print(""" You are lord Deadra. You have been sent to Citiel to
overthrow the current King Navator. Throughout your
travels, you will encounter various enemies of all
types. Good luck. """)
def displayInventory():
# Keeps a list of stuff in a dictionary. Because I returned
# stuff, I can use this function in other functions to update
print("Inventory:")
stuff = {"health potions": 5,
"poison": 5,
"stamina potions": 5,
"go crazy potion": 5,
"arrows": 50,
"hunting bow": 1,
"hunting knife": 1,
"big sword": 1,
"magic shield": 1}
return stuff
def displayStats():
# Displays initial health stats
print()
print("Stats:")
health = 100
stamina = 100
confidence = 100
return "health:",health, "stamina:",stamina, "confidence:",confidence
def firstBattle():
# First encounter with an enemy. After battle, update inventory
# and health stats
你需要一个损伤变量。 实现enemyDamage、enemyHealth和yourDamage变量。你知道吗
要实现这些武器,请使用类块更改其伤害值。你知道吗
相关问题 更多 >
编程相关推荐