lepsze kierunki ruchu sapera

This commit is contained in:
s464859 2022-03-09 11:33:57 +01:00
parent fc2d41e07d
commit 3eac875cc4
2 changed files with 11 additions and 14 deletions

View File

@ -45,24 +45,21 @@ class Minesweeper:
self.update_offset(delta)
def move(self, dir:int):
#południe
#południe - 0
#wschód - 90
#północ - 180
#zachód - 270
self.rotated_image = pygame.transform.rotate(self.image, dir)
if dir==0:
self.rotated_image = pygame.transform.rotate(self.image, 0)
self.position_y+=1
self.offset_y=-self.size
#północ
elif dir==1:
self.rotated_image = pygame.transform.rotate(self.image, 180)
elif dir==180:
self.position_y-=1
self.offset_y=self.size
#zachód
elif dir==2:
self.rotated_image = pygame.transform.rotate(self.image, 270)
elif dir==270:
self.position_x-=1
self.offset_x=self.size
#wschód
elif dir==3:
self.rotated_image = pygame.transform.rotate(self.image, 90)
elif dir==90:
self.position_x+=1
self.offset_x=-self.size

View File

@ -34,11 +34,11 @@ def main():
if keys[pygame.K_DOWN] and not_moving:
map.minesweeper.move(0)
elif keys[pygame.K_UP] and not_moving:
map.minesweeper.move(1)
map.minesweeper.move(180)
elif keys[pygame.K_LEFT] and not_moving:
map.minesweeper.move(2)
map.minesweeper.move(270)
elif keys[pygame.K_RIGHT] and not_moving:
map.minesweeper.move(3)
map.minesweeper.move(90)
#narysowanie terenu i obiektów