poprawa ruchu

This commit is contained in:
s444349 2020-04-03 17:38:42 +02:00
parent 5708e1fe21
commit d54adddfaa

View File

@ -40,7 +40,8 @@ class Smieciarka(pygame.sprite.Sprite):
self.w_dol()
def w_lewo(self):
if self.x > 0 or game.plansza[self.x - 1, self.y].jestPrzeszkoda is not True:
if self.x > 0:
if game.plansza[self.x - 1, self.y].jestPrzeszkoda is not True:
self.x -= 1
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
if self.ruch == 2:
@ -49,7 +50,8 @@ class Smieciarka(pygame.sprite.Sprite):
self.ruch = 1
def w_prawo(self):
if self.x < 14 or game.plansza[self.x + 1, self.y].jestPrzeszkoda is not True:
if self.x < 14:
if game.plansza[self.x + 1, self.y].jestPrzeszkoda is not True:
self.x += 1
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
if self.ruch == 1:
@ -57,12 +59,14 @@ class Smieciarka(pygame.sprite.Sprite):
self.ruch = 2
def w_gore(self):
if self.y > 0 or game.plansza[self.x, self.y - 1].jestPrzeszkoda is not True:
if self.y > 0:
if game.plansza[self.x, self.y - 1].jestPrzeszkoda is not True:
self.y -= 1
self.rect.y = self.y * HEIGHT + self.y * MARGIN
def w_dol(self):
if self.y < 14 or game.plansza[self.x, self.y + 1].jestPrzeszkoda is not True:
if self.y < 14:
if game.plansza[self.x, self.y + 1].jestPrzeszkoda is not True:
self.y += 1
self.rect.y = self.y * HEIGHT + self.y * MARGIN