Esempio n. 1
0
 def _initPlayers(self, parent):  
     players = []
     for x in (1,-1):
         for y in (1,-1):
             
             angle = ((x+1)/2)*math.pi + (abs(y+x)/2)*math.pi/2 
             xPos = util.WINDOW_SIZE[0]/2 + x*(util.WINDOW_SIZE[0]/2- util.WINDOW_SIZE[1]/8 )  
             yPos = util.WINDOW_SIZE[1]/2 + y*(util.WINDOW_SIZE[1]/2 - util.WINDOW_SIZE[1]/8)
             
             player = StaticQuadrantPlayer((xPos, yPos), angle, (x,y),color=self.playerColors.pop(), hasScore=False)
             infoManager = InfoManager(self._helpSystem, self._theme, owner=player)
             base = playerBases.DiagonalPlayerBase2Room( self._generator,
                                                    space=self.space, 
                                                    angle=player.angle,
                                                    parent=parent,
                                                    size=self._getCannonSize(),
                                                    position=player.pos,
                                                    owner=player,
                                                    helpSystem=self._helpSystem,
                                                    infoManager = infoManager    
       
                                                    )
             self._setBaseTimeoutForRejoin(base, util.CAP_INACTIVITY_TIMEOUT)
             base.destructionCallback = lambda: self._winCB(showKeyboards=False)
 
             players.append(player)
             player.base = base
     return players
Esempio n. 2
0
    def _initPlayers(self, parent):
        players = []
        self.__activationTimers = {}
        self.__cityCount = 0
        
        for x in (1,-1):
            for y in (1,-1):
                angle = ((x+1)/2)*math.pi + (abs(y+x)/2)*math.pi/2 
                xPos = util.WINDOW_SIZE[0]/2 + x*(util.WINDOW_SIZE[0]/2- util.WINDOW_SIZE[1]/8 )  
                yPos = util.WINDOW_SIZE[1]/2 + y*(util.WINDOW_SIZE[1]/2 - util.WINDOW_SIZE[1]/8)
                
                player = StaticQuadrantPlayer((xPos, yPos), angle, (x,y), color=self.playerColors.pop())
                infoManager = InfoManager(self._helpSystem, self._theme, owner=player)
                players.append(player)

                self.__cityCount +=1
                base = playerBases.DiagonalPlayerBase3Room( self._generator,
                                                        space=self.space, 
                                                        angle=player.angle,
                                                        parent=parent,
                                                        size=self._getCannonSize(),
                                                        position=player.pos,
                                                        owner=player,
                                                        helpSystem=self._helpSystem,
                                                        hitPoints=5,
                                                        showExitButton=True,
                                                        infoManager=infoManager,
                                                        )
    
                avg.Player.get().setTimeout(int(util.CANNON_ACTIVATION_TIMEOUT*1.1), lambda p=player : self._checkAlive(p))
                
                base.timeoutDuration = util.CANNON_ACTIVATION_TIMEOUT
                base.timeOutCB = lambda p=player : self.__removePlayer(p)
                
                base.destructionCallback = self.informAboutDestroyedCity
                player.base = base
            
        return players