|
|
@ -39,8 +39,8 @@ def draw_animal(s, delta_x=0, delta_y=0): |
|
|
|
] |
|
|
|
] |
|
|
|
for ellipse_rect in shift_points(rectangles, delta_x, delta_y): |
|
|
|
for ellipse_rect in shift_points(rectangles, delta_x, delta_y): |
|
|
|
ellipse(s, (255, 255, 255), ellipse_rect) |
|
|
|
ellipse(s, (255, 255, 255), ellipse_rect) |
|
|
|
ellipse(s, (229, 128, 255), (260, 567, 30, 26)) |
|
|
|
ellipse(s, (229, 128, 255), (260 + delta_x, 567 + delta_y, 30, 26)) |
|
|
|
ellipse(s, (0, 0, 0), (275, 574, 11, 10)) |
|
|
|
ellipse(s, (0, 0, 0), (275 + delta_x, 574 + delta_y, 11, 10)) |
|
|
|
polygon(s, (255, 255, 255), shift_points([ |
|
|
|
polygon(s, (255, 255, 255), shift_points([ |
|
|
|
(245, 580), (238, 573), (236, 569), (232, 563), |
|
|
|
(245, 580), (238, 573), (236, 569), (232, 563), |
|
|
|
(231, 559), (229, 555), (230, 550), (232, 556), |
|
|
|
(231, 559), (229, 555), (230, 550), (232, 556), |
|
|
@ -92,6 +92,29 @@ def draw_flowers(s, delta_x: int, delta_y: int): |
|
|
|
draw_rotated_flower(s, -angle, x + delta_x - 20, y + delta_y) |
|
|
|
draw_rotated_flower(s, -angle, x + delta_x - 20, y + delta_y) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def draw_animal_scaled(s, delta_x: int, delta_y: int, scale_x: float, scale_y: float): |
|
|
|
|
|
|
|
surface = pygame.Surface((214, 350), pygame.SRCALPHA) |
|
|
|
|
|
|
|
draw_animal(surface, -100, -540) |
|
|
|
|
|
|
|
surface = pygame.transform.scale(surface, (int(214 * abs(scale_x)), int(350 * abs(scale_y)))) |
|
|
|
|
|
|
|
surface = pygame.transform.flip(surface, scale_x < 0, scale_y < 0) |
|
|
|
|
|
|
|
s.blit( |
|
|
|
|
|
|
|
surface, |
|
|
|
|
|
|
|
surface.get_rect(center=(delta_x + int(214 * abs(scale_x) / 2), delta_y + int(350 * abs(scale_y) / 2))) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def draw_flowers_scaled(s, delta_x: int, delta_y: int, scale_x: float, scale_y: typing.Optional[float] = None): |
|
|
|
|
|
|
|
if scale_y is None: |
|
|
|
|
|
|
|
scale_y = scale_x |
|
|
|
|
|
|
|
surface = pygame.Surface((300, 300), pygame.SRCALPHA) |
|
|
|
|
|
|
|
draw_flowers(surface, 0, 0) |
|
|
|
|
|
|
|
surface = pygame.transform.scale(surface, (int(300 * scale_x), int(300 * scale_y))) |
|
|
|
|
|
|
|
s.blit( |
|
|
|
|
|
|
|
surface, |
|
|
|
|
|
|
|
surface.get_rect(center=(delta_x + int(150 * scale_x), delta_y + int(150 * scale_y))) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pygame.init() |
|
|
|
pygame.init() |
|
|
|
|
|
|
|
|
|
|
|
FPS = 30 |
|
|
|
FPS = 30 |
|
|
@ -99,9 +122,19 @@ W, H = 794, 1123 |
|
|
|
screen = pygame.display.set_mode((W, H)) |
|
|
|
screen = pygame.display.set_mode((W, H)) |
|
|
|
screen.fill((175, 221, 233)) |
|
|
|
screen.fill((175, 221, 233)) |
|
|
|
draw_background(screen) |
|
|
|
draw_background(screen) |
|
|
|
draw_animal(screen) |
|
|
|
|
|
|
|
# draw_flower(screen, 682, 814) |
|
|
|
draw_flowers_scaled(screen, 510, 892, 0.45) |
|
|
|
draw_flowers(screen, 515, 775) |
|
|
|
draw_flowers_scaled(screen, 751, 1035, 0.28) |
|
|
|
|
|
|
|
draw_flowers_scaled(screen, 664, 730, 0.5) |
|
|
|
|
|
|
|
draw_flowers_scaled(screen, 561, 666, 0.36) |
|
|
|
|
|
|
|
draw_flowers_scaled(screen, 694, 604, 0.32) |
|
|
|
|
|
|
|
draw_flowers_scaled(screen, -20, 576, 0.3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_animal_scaled(screen, -150, 730, 2, 2) |
|
|
|
|
|
|
|
draw_animal_scaled(screen, 165, 586, 0.4, 0.4) |
|
|
|
|
|
|
|
draw_animal_scaled(screen, 318, 639, -0.4, 0.4) |
|
|
|
|
|
|
|
draw_animal_scaled(screen, 279, 465, 0.4, 0.4) |
|
|
|
|
|
|
|
draw_animal_scaled(screen, 664, 595, -0.95, 0.95) |
|
|
|
|
|
|
|
|
|
|
|
pygame.display.update() |
|
|
|
pygame.display.update() |
|
|
|
clock = pygame.time.Clock() |
|
|
|
clock = pygame.time.Clock() |
|
|
|