From fe6775531b8189b670273007869aac63b4ae7b65 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Wed, 19 Jul 2023 16:19:11 +0200 Subject: [PATCH] Disabled image rotation. --- screensaver.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/screensaver.py b/screensaver.py index ab061fd..9ce8ae1 100644 --- a/screensaver.py +++ b/screensaver.py @@ -15,7 +15,7 @@ red = (255, 20, 20) working_directory = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.abspath(__file__) wobblers = [] -max_wobbler_size = 50 +max_wobbler_size = 100 images = [] for image in os.listdir(f"{working_directory}/textures"): @@ -41,26 +41,26 @@ class Wobbler: self.age = 0 - self.cube = pygame.Surface((self.height, self.width)) - self.cube.fill(self.color) - self.cube_no_rot = self.cube - self.cube.set_colorkey(gray) - self.cube = pygame.transform.rotate(self.cube, self.rotation) - self.cube_rect = self.cube.get_rect(center=self.cube_no_rot.get_rect(center=(self.x, self.y)).center) + self.image_original = random.choice(images) + + self.image = self.image_original + self.image = pygame.transform.scale(self.image, (self.width, self.height)) + self.image_no_rot = self.image + #self.image = pygame.transform.rotate(self.image, self.rotation) + self.image_rect = self.image.get_rect(center=self.image_no_rot.get_rect(center=(self.x, self.y)).center) def draw(self): - screen.blit(self.cube, self.cube_rect) + screen.blit(self.image, self.image_rect) def update(self): self.width = self.size self.height = self.size - self.cube = pygame.Surface((self.height, self.width)) - self.cube.fill(self.color) - self.cube_no_rot = self.cube - self.cube.set_colorkey(gray) - self.cube = pygame.transform.rotate(self.cube, self.rotation) - self.cube_rect = self.cube.get_rect(center=self.cube_no_rot.get_rect(center=(self.x, self.y)).center) + self.image = self.image_original + self.image = pygame.transform.scale(self.image, (self.width, self.height)) + self.image_no_rot = self.image + #self.image = pygame.transform.rotate(self.image, self.rotation) + self.image_rect = self.image.get_rect(center=self.image_no_rot.get_rect(center=(self.x, self.y)).center) def move(self): x_offset, y_offset = deg_to_offset(self.rotation, self.speed)