This commit is contained in:
s464859 2022-04-16 20:14:55 +02:00
parent 62c3409aa1
commit 376c0df788
3 changed files with 14 additions and 4 deletions

BIN
assets/sprites/grass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -11,7 +11,7 @@ class AI:
the_way:list
#jak True to można się poruszać strzałkami, jak False sam się porusza
user_controlled=False
user_controlled=True
def __init__(self, window, current_map, saper):
self.window = window
@ -54,11 +54,11 @@ class AI:
if keys[pygame.K_DOWN]:
self.saper.move(0)
elif keys[pygame.K_UP]:
self.saper.move()
self.saper.move(180)
elif keys[pygame.K_LEFT]:
self.saper.rotate("left")
self.saper.move(270)
elif keys[pygame.K_RIGHT]:
self.saper.rotate("right")
self.saper.move(90)
def chaos_controls(self):
dir = randrange(4)

View File

@ -84,6 +84,10 @@ class Map:
image = pygame.image.load("assets/sprites/stone.png")
image = pygame.transform.scale(image, (tile_size,tile_size))
self.tile_palette[10]=image
image = pygame.image.load("assets/sprites/grass.png")
image = pygame.transform.scale(image, (tile_size,tile_size))
self.tile_palette[5]=image
def generate(self):
#generowanie terenu
@ -108,6 +112,8 @@ class Map:
rng = randrange(10)
if ok and rng==0 and not (i<2 and j<3):
matrix[i].append(10)
elif ok and rng>8 and not (i<2 and j<3):
matrix[i].append(5)
elif ok and rng<2 and not (i<2 and j<3):
matrix[i].append(0)
rand_rotate = 0#randrange(4)*90
@ -255,6 +261,8 @@ class Minesweeper:
pygame.mixer.Channel(1).stop()
self.offset_y=0
self.offset_x=0
if self.current_map.terrain_matrix[self.position_y][self.position_x]<5:
self.speed=1
def draw(self, window, delta:float):
@ -326,6 +334,8 @@ class Minesweeper:
move_legal=False
if move_legal:
if self.current_map.terrain_matrix[next_y][next_x]>4:
self.speed=0.5
pygame.mixer.Channel(1).set_volume(0.3)
pygame.mixer.Channel(1).play(pygame.mixer.Sound("assets/sounds/moving.wav"))
if dir==0: