trawa
This commit is contained in:
parent
62c3409aa1
commit
376c0df788
BIN
assets/sprites/grass.png
Normal file
BIN
assets/sprites/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
@ -11,7 +11,7 @@ class AI:
|
|||||||
the_way:list
|
the_way:list
|
||||||
|
|
||||||
#jak True to można się poruszać strzałkami, jak False sam się porusza
|
#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):
|
def __init__(self, window, current_map, saper):
|
||||||
self.window = window
|
self.window = window
|
||||||
@ -54,11 +54,11 @@ class AI:
|
|||||||
if keys[pygame.K_DOWN]:
|
if keys[pygame.K_DOWN]:
|
||||||
self.saper.move(0)
|
self.saper.move(0)
|
||||||
elif keys[pygame.K_UP]:
|
elif keys[pygame.K_UP]:
|
||||||
self.saper.move()
|
self.saper.move(180)
|
||||||
elif keys[pygame.K_LEFT]:
|
elif keys[pygame.K_LEFT]:
|
||||||
self.saper.rotate("left")
|
self.saper.move(270)
|
||||||
elif keys[pygame.K_RIGHT]:
|
elif keys[pygame.K_RIGHT]:
|
||||||
self.saper.rotate("right")
|
self.saper.move(90)
|
||||||
|
|
||||||
def chaos_controls(self):
|
def chaos_controls(self):
|
||||||
dir = randrange(4)
|
dir = randrange(4)
|
||||||
|
@ -84,6 +84,10 @@ class Map:
|
|||||||
image = pygame.image.load("assets/sprites/stone.png")
|
image = pygame.image.load("assets/sprites/stone.png")
|
||||||
image = pygame.transform.scale(image, (tile_size,tile_size))
|
image = pygame.transform.scale(image, (tile_size,tile_size))
|
||||||
self.tile_palette[10]=image
|
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):
|
def generate(self):
|
||||||
#generowanie terenu
|
#generowanie terenu
|
||||||
@ -108,6 +112,8 @@ class Map:
|
|||||||
rng = randrange(10)
|
rng = randrange(10)
|
||||||
if ok and rng==0 and not (i<2 and j<3):
|
if ok and rng==0 and not (i<2 and j<3):
|
||||||
matrix[i].append(10)
|
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):
|
elif ok and rng<2 and not (i<2 and j<3):
|
||||||
matrix[i].append(0)
|
matrix[i].append(0)
|
||||||
rand_rotate = 0#randrange(4)*90
|
rand_rotate = 0#randrange(4)*90
|
||||||
@ -255,6 +261,8 @@ class Minesweeper:
|
|||||||
pygame.mixer.Channel(1).stop()
|
pygame.mixer.Channel(1).stop()
|
||||||
self.offset_y=0
|
self.offset_y=0
|
||||||
self.offset_x=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):
|
def draw(self, window, delta:float):
|
||||||
@ -326,6 +334,8 @@ class Minesweeper:
|
|||||||
move_legal=False
|
move_legal=False
|
||||||
|
|
||||||
if move_legal:
|
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).set_volume(0.3)
|
||||||
pygame.mixer.Channel(1).play(pygame.mixer.Sound("assets/sounds/moving.wav"))
|
pygame.mixer.Channel(1).play(pygame.mixer.Sound("assets/sounds/moving.wav"))
|
||||||
if dir==0:
|
if dir==0:
|
||||||
|
Loading…
Reference in New Issue
Block a user