obracanie smieciarki
This commit is contained in:
parent
ba52a72fd9
commit
c31ba95788
7
game.py
7
game.py
@ -7,6 +7,7 @@ class Smieciarka(pygame.sprite.Sprite):
|
|||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.image = pygame.image.load('smieciarka.png')
|
self.image = pygame.image.load('smieciarka.png')
|
||||||
|
self.ruch = 0
|
||||||
pygame.sprite.Sprite.__init__(self)
|
pygame.sprite.Sprite.__init__(self)
|
||||||
self.rect = pygame.Rect(self.x * WIDTH + MARGIN * self.x + MARGIN, self.y * HEIGHT + MARGIN * self.y, WIDTH,
|
self.rect = pygame.Rect(self.x * WIDTH + MARGIN * self.x + MARGIN, self.y * HEIGHT + MARGIN * self.y, WIDTH,
|
||||||
HEIGHT)
|
HEIGHT)
|
||||||
@ -15,13 +16,17 @@ class Smieciarka(pygame.sprite.Sprite):
|
|||||||
if self.x > 0:
|
if self.x > 0:
|
||||||
self.x -= 1
|
self.x -= 1
|
||||||
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
||||||
|
if self.ruch == 2:
|
||||||
self.image = pygame.image.load('smieciarka.png')
|
self.image = pygame.image.load('smieciarka.png')
|
||||||
|
self.ruch = 1
|
||||||
|
|
||||||
def w_prawo(self):
|
def w_prawo(self):
|
||||||
if self.x < 14:
|
if self.x < 14:
|
||||||
self.x += 1
|
self.x += 1
|
||||||
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
||||||
self.image = pygame.image.load('smieciarka_odwrocona.png')
|
if self.ruch == 1:
|
||||||
|
self.image = pygame.transform.flip(smieciarka.image, True, False)
|
||||||
|
self.ruch = 2
|
||||||
|
|
||||||
def w_gore(self):
|
def w_gore(self):
|
||||||
if self.y > 0:
|
if self.y > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user