本文整理匯總了Python中Data.start_game方法的典型用法代碼示例。如果您正苦於以下問題:Python Data.start_game方法的具體用法?Python Data.start_game怎麽用?Python Data.start_game使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Data
的用法示例。
在下文中一共展示了Data.start_game方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: checkend
# 需要導入模塊: import Data [as 別名]
# 或者: from Data import start_game [as 別名]
def checkend(self):
if self.user[2] <= 0: #zero health!
print "OH NO. You lost..."
print "Going to main menu."
time.sleep(3)
Data.start_game(self.original_stats)
if self.mons[1] <= 0:
print "You won!"
gain = random.randint(1, 5)
if gain > 2:
print "Gained stats!"
self.original_stats[2] += gain ##todo: stat changing per level gain?
self.original_stats[3] += gain
self.original_stats[4] += gain
self.original_stats[5] += gain
time.sleep(2)
Data.start_game(self.original_stats)
示例2: player_move
# 需要導入模塊: import Data [as 別名]
# 或者: from Data import start_game [as 別名]
def player_move(self):
print '''What would you like to do?
[1]attack
[2]insult
[3]run'''
user_choice = raw_input("\n")
try:
user_choice = int(user_choice)
except:
print "invalid"
clear.clrscr()
self.player_move()
if user_choice == 1:
self.player_attack()
elif user_choice == 2:
self.player_insult()
elif user_choice == 3:
print "You ran!!"
Data.start_game(self.original_stats)
else:
print "Not a valid choice."
self.player_move()