當前位置: 首頁>>代碼示例>>Python>>正文


Python Data.start_game方法代碼示例

本文整理匯總了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)
開發者ID:aperture321,項目名稱:Digitaks,代碼行數:19,代碼來源:Monsters.py

示例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()
開發者ID:aperture321,項目名稱:Digitaks,代碼行數:24,代碼來源:Monsters.py


注:本文中的Data.start_game方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。