def __init__(self, pos, x, y, obs): super().__init__() #self.pos = pos self.x = x self.y = y self.obstacle = obs self.image, self.rect = utils.setImage(self.x, self.y, "cell")
def __init__(self, pos, x, y, delivery): super().__init__() self.x = x self.y = y self.pos = pos self.delivery = delivery self.image, self.rect = utils.setImage(self.x, self.y, "building")
def updateCell(self, rand): """ Needed to update view of cell with obstacle (if generted randomly) :param rand: random pos to obstacle (rand is the pos on the list of objects of type cell, not on the map) """ pos = self.__getitem__(rand).__dict__.get('pos') x = self.__getitem__(rand).__dict__.get('x') y = self.__getitem__(rand).__dict__.get('y') self.image, self.rect = utils.setImage(x, y, "obs") setattr(self.cells[rand], 'obstacle', not self.cells[rand].__dict__.get('obstacle')) setattr(self.cells[rand], 'image', self.image)
def __init__(self, x, y, company, surface, name, id, rot): super().__init__() self.x = x self.y = y self.dx = 0 self.dy = 0 # initial position pointing left self.direction = constants.ROT[rot] self.surface = surface self.name = name self.battery = 100 self.hasCargo = False self.idDelivery = None self.myCompany = company self.dMade = [] self.startD = 0 self.stopD = 0 self.pause = False self.prepared = False self.pausedDelivering = [] self.count = 10 # equilave a 10 iterações ~=1.4189 segundos --> to recharge # self.count = 100 # equilave a 100 iterações ~=10 * 1.4189 segundos self.myId = id if self.myCompany == 'cp1': img = "dogp_cp01" rot_angle = 90 else: img = "dogp_cp02" rot_angle = -90 self.image, self.rect = utils.setImage(self.x, self.y, img) self.image = pygame.transform.rotate(self.image, rot_angle) world.World.updateAgentLocation(world.World, self.x, self.y, True) print("-> {} at: row: {}, col: {}".format(self.name, self.x, self.y)) print("-> {}: hasCargo={}, idDelivery={}".format( self.name, self.hasCargo, self.idDelivery)) self.myWorldMap = np.full( [constants.NUMBER_OF_BLOCKS_WIDE, constants.NUMBER_OF_BLOCKS_HIGH], "_") self.buildingsDetected = np.empty( [constants.NUMBER_OF_BLOCKS_WIDE, constants.NUMBER_OF_BLOCKS_HIGH], dtype=object) self.movingTo = False self.path = [] self.unable = False
def __init__(self, x, y, company, surface, name, id, rot): super().__init__() self.x = x self.y = y self.dx = 0 self.dy = 0 self.direction = constants.ROT[rot] # initial position pointing right self.surface = surface self.name = name self.battery = 100 self.hasCargo = False self.idDelivery = None self.myCompany = company self.dMade = [] self.startD = 0 self.stopD = 0 self.pause = False self.prepared = False self.pausedDelivering = [] self.count = 10 # equilave a 10 iterações ~=1.4189 segundos --> to recharge # self.count = 100 # equilave a 100 iterações ~=10 * 1.4189 segundos self.myId = id if self.myCompany == 'cp1': img = "dogr_cp01" rot_angle = 90 else: img = "dogr_cp02" rot_angle = -90 self.image, self.rect = utils.setImage(self.x, self.y, img) self.image = pygame.transform.rotate(self.image, rot_angle) world.World.updateAgentLocation(world.World, self.x, self.y, True) print("-> {} at: row: {}, col: {}".format(self.name, self.x, self.y)) print("-> {}: hasCargo={}, idDelivery={}".format( self.name, self.hasCargo, self.idDelivery))
def changeImage(self): self.image, self.rect = utils.setImage(self.x, self.y, "building")
def __init__(self, x, y): super().__init__() self.x = x self.y = y self.image, self.rect = utils.setImage(self.x, self.y, "obs")