Пример #1
0
 def draw_label(self, my_label):
     offset = int(0.5 * gui.PATCH_SIZE)
     obj_center = XY(((3 * self.agent_1.x + self.agent_2.x) / 4,
                      (3 * self.agent_1.y + self.agent_2.y) / 4))
     text_center = (obj_center.x + offset, obj_center.y + offset)
     line_color = self.color
     gui.draw_label(my_label, text_center, obj_center, line_color)
Пример #2
0
    def create_blank_base_image(self):

        # Give the agent a larger Surface (by sqrt(2)) to work with since it may rotate.
        surface_size = XY((self.rect.width, self.rect.height)) * SQRT_2
        blank_base_image = Surface(surface_size)

        # This sets the rectangle to be transparent.
        # Otherwise it would be black and would cover nearby agents.
        # Even though it's a method of Surface, it can also take a Surface parameter.
        # If the Surface parameter is not given, PyCharm complains.
        # noinspection PyArgumentList
        blank_base_image = blank_base_image.convert_alpha()
        blank_base_image.fill((0, 0, 0, 0))
        return blank_base_image