本文整理匯總了Python中team.Team.objectslist方法的典型用法代碼示例。如果您正苦於以下問題:Python Team.objectslist方法的具體用法?Python Team.objectslist怎麽用?Python Team.objectslist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類team.Team
的用法示例。
在下文中一共展示了Team.objectslist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Profile
# 需要導入模塊: from team import Team [as 別名]
# 或者: from team.Team import objectslist [as 別名]
#.........這裏部分代碼省略.........
self.hell = HellDebrisCollection(self.spawn, self.pl, self.hellmin, self.hellmax)
if self.p1_team == "Green":
self.player1 = self.team1.guys[0]
if self.p2:
if self.p2_team == "Green":
self.player2 = self.team1.guys[1]
elif self.p2_team == "Red":
self.player2 = self.team2.guys[0]
else:
raise Exception("unknown team for p2: %s" % self.p2_team)
elif self.p1_team == "Red":
self.player1 = team2.guys[0]
if self.p2:
if self.p2_team == "Green":
self.player2 = self.team1.guys[0]
elif self.p2_team == "Red":
self.player2 = self.team2.guys[1]
else:
raise Exception("unknown team for p2: %s" % self.p2_team)
else:
raise Exception("unknown team for p1: %s" % self.p1_team)
self.player1.is_ai = self.p1_ai
if self.p1_ai:
self.player1.set_name("[bot] %s" % p1_name)
else:
self.player1.set_name("%s" % p1_name)
if self.p2:
self.player2.is_ai = self.p2_ai
if self.p2_ai:
self.player2.set_name("[bot] %s" % p2_name)
else:
self.player2.set_name("%s" % p2_name)
self.stats1 = SimpleStats(self.team1, self.team2, self.player1)
if self.p2:
self.stats2 = SimpleStats(self.team1, self.team2, self.player2)
def game_key_listen(self, event):
if event.type == KEYDOWN and event.key == K_F1:
self.PROFILESTEP = True
self.game_step()
elif event.type == KEYDOWN and event.key == K_F2:
print len(GCD_Singleton.orbitables)
elif event.type == KEYDOWN and event.key == K_F5:
self.soundsys.switch()
if not self.p1_ai:
self.player1.catch_kb_event(event)
if self.p2 and not self.p2_ai:
self.player2.catch_kb_event_hotseat(event)
self.cam1.keys_listen(event)
if self.p2:
self.cam2.keys_listen_hotseat(event)
def game_step(self):
if self.PROFILESTEP:
profile.runctx("self._step()", globals(), {"self": self})
else:
self._step()
def _step(self):
self.team2.step() # todo faster better stronger
self.team1.step()
self.hell.step()
self.player1.focus(self.cam1)
self.cam1.step()
if self.p2:
self.player2.focus(self.cam2)
self.cam2.step()
GCD_Singleton.step()
def game_draw(self):
if self.PROFILESTEP:
profile.runctx("self._draw()", globals(), {"self": self})
self.PROFILESTEP = False
else:
self._draw()
def _draw(self):
clock.tick(60)
tup = [self.pl, ] + self.team1.objectslist() + self.team2.objectslist()\
+ self.hell.objectslist() + self.pl.cities
tup = tuple(tup)
self.cam1.translate_coords(*tup)
if self.p2:
self.cam2.translate_coords(*tup)
self.stats1.draw(self.bg1)
self.screen.blit(self.bg1, (0, 0))
if self.p2:
self.stats2.draw(self.bg2)
self.screen.blit(self.bg2, (0, wheight/2))
pygame.display.update()