Example #1
0
 def get_enemy_intersecting_rect(self,
                                 rect: Rect) -> List[NonPlayerCharacter]:
     return [
         e for e in self.non_player_characters
         if e.is_enemy and rects_intersect(e.world_entity.rect(), rect)
     ]
Example #2
0
 def _is_npc_close_to_camera(self, npc: NonPlayerCharacter):
     camera_rect_with_margin = get_rect_with_increased_size_in_all_directions(
         self.game_state.camera_world_area, 100)
     return rects_intersect(npc.world_entity.rect(),
                            camera_rect_with_margin)
Example #3
0
 def does_rect_intersect_with_wall(self, rect: Rect):
     nearby_walls = self.get_walls_close_to_position((rect[0], rect[1]))
     return any(
         [w for w in nearby_walls if rects_intersect(w.rect(), rect)])