This commit is contained in:
Bowske 2020-04-03 17:41:25 +02:00
commit ec587f3bf3

View File

@ -40,7 +40,8 @@ class Smieciarka(pygame.sprite.Sprite):
self.w_dol() self.w_dol()
def w_lewo(self): 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.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: if self.ruch == 2:
@ -49,7 +50,8 @@ class Smieciarka(pygame.sprite.Sprite):
self.ruch = 1 self.ruch = 1
def w_prawo(self): 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.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 == 1: if self.ruch == 1:
@ -57,12 +59,14 @@ class Smieciarka(pygame.sprite.Sprite):
self.ruch = 2 self.ruch = 2
def w_gore(self): 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.y -= 1
self.rect.y = self.y * HEIGHT + self.y * MARGIN self.rect.y = self.y * HEIGHT + self.y * MARGIN
def w_dol(self): 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.y += 1
self.rect.y = self.y * HEIGHT + self.y * MARGIN self.rect.y = self.y * HEIGHT + self.y * MARGIN