Exemplo n.º 1
0
 def __init__(self, speed = [2,2], size = [100,100], pos = (0,0)):
     Vacuum.__init__(self, speed, size, pos)
     self.baseImage = pygame.image.load("Resources/Player/superVacuum.png")
     self.baseImage = pygame.transform.scale(self.baseImage, size)
     rot_image = pygame.transform.rotate(self.baseImage, self.angle)
     rot_rect = self.rect.copy()
     rot_rect.center = rot_image.get_rect().center
     rot_image = rot_image.subsurface(rot_rect)
     self.image = rot_image
Exemplo n.º 2
0
    # create a commander object.
    @staticmethod
    def spawnCommander() :
	commander = Commander()
	channel = commander.initializeChannel()
	channel.setCommander(commander)
	return(commander)



if (__name__ =='__main__') :
    from Vacuum import Vacuum
    
    commander = Commander()
    commander = Commander.spawnCommander()
    commander.setHostInformation(Router.PLANNER,  "10.0.1.11",10001,None)
    commander.setHostInformation(Router.COMMANDER,"10.0.1.12",10002,None)
    commander.setHostname("10.0.1.12")
    commander.setPort(10002)

    commander.getChannel().setNumberVacuums(1)

    vacuum = Vacuum.spawnVacuum(0,0)
    vacuum.getChannel().setNumberVacuums(1)
    vacuum.setRouterChannel(Router.COMMANDER,commander.getChannel())
    commander.setVacuumRouterInformation(vacuum.getChannel(),0,0,0)

    commander.start()
    print("The commander is running")
    commander.join()