当前位置: 首页>>代码示例>>Python>>正文


Python Team.objectslist方法代码示例

本文整理汇总了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()
开发者ID:mr555ru,项目名称:orbotor,代码行数:104,代码来源:gameprofile.py


注:本文中的team.Team.objectslist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。