poprawa ruchu
This commit is contained in:
parent
5708e1fe21
commit
d54adddfaa
42
modele.py
42
modele.py
@ -40,31 +40,35 @@ 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:
|
||||||
self.x -= 1
|
if game.plansza[self.x - 1, self.y].jestPrzeszkoda is not True:
|
||||||
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
self.x -= 1
|
||||||
if self.ruch == 2:
|
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
||||||
self.image = pygame.image.load(
|
if self.ruch == 2:
|
||||||
'resources/plansza/smieciarka.png')
|
self.image = pygame.image.load(
|
||||||
self.ruch = 1
|
'resources/plansza/smieciarka.png')
|
||||||
|
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:
|
||||||
self.x += 1
|
if game.plansza[self.x + 1, self.y].jestPrzeszkoda is not True:
|
||||||
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
self.x += 1
|
||||||
if self.ruch == 1:
|
self.rect.x = MARGIN + self.x * WIDTH + self.x * MARGIN
|
||||||
self.image = pygame.transform.flip(self.image, True, False)
|
if self.ruch == 1:
|
||||||
self.ruch = 2
|
self.image = pygame.transform.flip(self.image, True, False)
|
||||||
|
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:
|
||||||
self.y -= 1
|
if game.plansza[self.x, self.y - 1].jestPrzeszkoda is not True:
|
||||||
self.rect.y = self.y * HEIGHT + self.y * MARGIN
|
self.y -= 1
|
||||||
|
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:
|
||||||
self.y += 1
|
if game.plansza[self.x, self.y + 1].jestPrzeszkoda is not True:
|
||||||
self.rect.y = self.y * HEIGHT + self.y * MARGIN
|
self.y += 1
|
||||||
|
self.rect.y = self.y * HEIGHT + self.y * MARGIN
|
||||||
|
|
||||||
|
|
||||||
class Kontener(pygame.sprite.Sprite):
|
class Kontener(pygame.sprite.Sprite):
|
||||||
|
Loading…
Reference in New Issue
Block a user