Disabled image scaling because of low quality.
This commit is contained in:
parent
fe6775531b
commit
941cb16a87
1 changed files with 9 additions and 6 deletions
|
@ -28,8 +28,6 @@ running = True
|
||||||
class Wobbler:
|
class Wobbler:
|
||||||
def __init__(self, position: tuple=(100, 100), rotation: int=0):
|
def __init__(self, position: tuple=(100, 100), rotation: int=0):
|
||||||
self.size = 1
|
self.size = 1
|
||||||
self.width = self.size
|
|
||||||
self.height = self.size
|
|
||||||
|
|
||||||
self.x, self.y = position
|
self.x, self.y = position
|
||||||
|
|
||||||
|
@ -43,23 +41,28 @@ class Wobbler:
|
||||||
|
|
||||||
self.image_original = random.choice(images)
|
self.image_original = random.choice(images)
|
||||||
|
|
||||||
|
self.max_width, self.max_height = self.image_original.get_size()
|
||||||
|
|
||||||
|
self.width = self.max_width * self.size / 100
|
||||||
|
self.height = self.max_height * self.size / 100
|
||||||
|
|
||||||
self.image = self.image_original
|
self.image = self.image_original
|
||||||
self.image = pygame.transform.scale(self.image, (self.width, self.height))
|
self.image = pygame.transform.scale(self.image, (self.width, self.height))
|
||||||
self.image_no_rot = self.image
|
self.image_no_rot = self.image
|
||||||
#self.image = pygame.transform.rotate(self.image, self.rotation)
|
# 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)
|
self.image_rect = self.image.get_rect(center=self.image_no_rot.get_rect(center=(self.x, self.y)).center)
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
screen.blit(self.image, self.image_rect)
|
screen.blit(self.image, self.image_rect)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.width = self.size
|
self.width = self.max_width * self.size / 100
|
||||||
self.height = self.size
|
self.height = self.max_height * self.size / 100
|
||||||
|
|
||||||
self.image = self.image_original
|
self.image = self.image_original
|
||||||
self.image = pygame.transform.scale(self.image, (self.width, self.height))
|
self.image = pygame.transform.scale(self.image, (self.width, self.height))
|
||||||
self.image_no_rot = self.image
|
self.image_no_rot = self.image
|
||||||
#self.image = pygame.transform.rotate(self.image, self.rotation)
|
# 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)
|
self.image_rect = self.image.get_rect(center=self.image_no_rot.get_rect(center=(self.x, self.y)).center)
|
||||||
|
|
||||||
def move(self):
|
def move(self):
|
||||||
|
|
Loading…
Reference in a new issue