Ejemplo n.º 1
0
 def draw(self, screen):
     if not self.visible:
         return
     diameter = self.radius * 2
     s = pygame.Surface((diameter, diameter), pygame.SRCALPHA)
     color = (255, 255, 0, 128) if self.collided else (128, 0, 128, 128)
     pygame.draw.circle(s, color, (self.radius, self.radius), self.radius)
     c_x, c_y = self.center
     camera.blit(s, (c_x - self.radius, c_y - self.radius))
Ejemplo n.º 2
0
    def draw_flame(self, screen):
        image_height = int(abs(self.velocity)) + 10
        flame_subsurface = self.flame_image.subsurface(self.flame_frame * 20,
                                                       20 - image_height, 20,
                                                       image_height)
        rotated_image = pygame.transform.rotate(flame_subsurface,
                                                self.angle - 180)
        w, h = rotated_image.get_size()

        distance_from_center = (20 + int(abs(self.velocity) / 2))
        camera.blit(
            rotated_image,
            (self.x - distance_from_center * self.orientation_vector_x - w / 2,
             self.y - distance_from_center * self.orientation_vector_y -
             h / 2))
Ejemplo n.º 3
0
 def draw_melon(self, screen):
     rotated_image = pygame.transform.rotate(self.image, self.angle - 180)
     w, h = rotated_image.get_size()
     camera.blit(rotated_image, (self.x - w / 2, self.y - h / 2))
Ejemplo n.º 4
0
 def draw(self, screen):
     super().draw(screen)
     rotated_image = pygame.transform.rotate(self.image, self.angle)
     w, h = rotated_image.get_size()
     camera.blit(rotated_image, (self.x - w / 2, self.y - h / 2))
Ejemplo n.º 5
0
 def draw(self, screen):
     w, h = self.image.get_size()
     camera.blit(self.image, (self.x - w / 2, self.y - h / 2))
Ejemplo n.º 6
0
 def draw(self, screen):
     super().draw(screen)
     camera.blit(self.image, (self.x - 5, self.y - 5, 10, 10),
                 (0, 0, 10, 10))