lepsze kierunki ruchu sapera
This commit is contained in:
parent
fc2d41e07d
commit
3eac875cc4
@ -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
|
||||
|
||||
|
6
main.py
6
main.py
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user