Exemple #1
0
 def __init__(self, gameManager, playerID):
     self.gameManager = gameManager
     self.playerID = playerID
     
     self.gameMap = ClientGameMap(self)
     self.viewAndInput = None
     self.running = True
Exemple #2
0
class Client(object):
    def __init__(self, gameManager, playerID):
        self.gameManager = gameManager
        self.playerID = playerID
        
        self.gameMap = ClientGameMap(self)
        self.viewAndInput = None
        self.running = True
    
    
    def getGameMap(self):
        return self.gameMap

    def getPlayer(self):
        return self.gameManager.getCharacterInfo(self.playerID)
    
    
    def getStaticPolygons(self):
        return self.gameManager.getStaticPolygons()
    
    def getDynamicPolygons(self):
        return self.gameManager.getDynamicPolygons()
    
    def moveRotateCharacter(self,
                            moveDeltaForward, moveDeltaLeft,
                            rotation):
        '''wrapper for GameManager method'''
        self.gameManager.moveRotateCharacter(self.playerID,
                                             moveDeltaForward, moveDeltaLeft,
                                             rotation)
    
    def start(self):
        self.gameMap.start()
        self.viewAndInput.start()
        
        while self.running:
            sleep(0.25)

        self.viewAndInput.stop()
        self.gameMap.stop()
        print("stopped client::gameMap")
        self.gameMap.join()
        print("joined client::gameMap")
        
    
    
    def stop(self):
        self.running = False