def do_attack(self, dissapear=False): entity = self.bg.tiles[(self.x, self.y)].entity if entity and entity.can_be_attacked(): if not entity.is_ally(self): entity.get_attacked(self) if dissapear: self.dissapear()
def update(self): super(Orb, self).update() if self.alive: for (pos_x, pos_y) in itertools.product([-1,0,1], [-1,0,1]): if self.bg.is_inside(self.x+pos_x, self.y+pos_y): entity = self.bg.tiles[(self.x+pos_x), (self.y+pos_y)].entity if entity and not entity.is_ally(self) and entity not in self.attacked_entities: entity.get_attacked(self) self.attacked_entities.append(entity)
def update(self): super(Orb, self).update() if self.alive: for (pos_x, pos_y) in itertools.product([-1, 0, 1], [-1, 0, 1]): if self.bg.is_inside(self.x + pos_x, self.y + pos_y): entity = self.bg.tiles[(self.x + pos_x), (self.y + pos_y)].entity if entity and not entity.is_ally( self) and entity not in self.attacked_entities: entity.get_attacked(self) self.attacked_entities.append(entity)