niedziałające klify
This commit is contained in:
parent
d095fe469e
commit
c4a623ae6d
BIN
assets/sprites/cliff.png
Normal file
BIN
assets/sprites/cliff.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -24,6 +24,29 @@ class Mine:
|
|||||||
position_on_screen = (self.size*self.position_x, self.size*self.position_y)
|
position_on_screen = (self.size*self.position_x, self.size*self.position_y)
|
||||||
window.blit(self.image, position_on_screen)
|
window.blit(self.image, position_on_screen)
|
||||||
|
|
||||||
|
class Cliff:
|
||||||
|
position_x:int
|
||||||
|
position_y:int
|
||||||
|
size:int
|
||||||
|
image:pygame.surface.Surface
|
||||||
|
|
||||||
|
rotation:int
|
||||||
|
|
||||||
|
def __init__(self,position_x, position_y, size, rotation):
|
||||||
|
self.position_x=position_x
|
||||||
|
self.position_y=position_y
|
||||||
|
self.size=size
|
||||||
|
self.rotation = rotation
|
||||||
|
self.image = pygame.image.load("assets/sprites/cliff.png")
|
||||||
|
self.image = pygame.transform.scale(self.image, (self.size, self.size))
|
||||||
|
self.image = pygame.transform.rotate(self.image, self.rotation)
|
||||||
|
|
||||||
|
def draw(self, window):
|
||||||
|
position_on_screen = (self.size*self.position_x, self.size*self.position_y)
|
||||||
|
window.blit(self.image, position_on_screen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#mapa
|
#mapa
|
||||||
class Map:
|
class Map:
|
||||||
@ -35,6 +58,7 @@ class Map:
|
|||||||
tile_palette:list
|
tile_palette:list
|
||||||
terrain_matrix:list
|
terrain_matrix:list
|
||||||
|
|
||||||
|
cliffs=[]
|
||||||
mines=[]
|
mines=[]
|
||||||
|
|
||||||
def __init__(self, window:system.Window, tile_size:int=64, tiles_x:int=8, tiles_y:int=8):
|
def __init__(self, window:system.Window, tile_size:int=64, tiles_x:int=8, tiles_y:int=8):
|
||||||
@ -61,8 +85,13 @@ class Map:
|
|||||||
matrix.append([])
|
matrix.append([])
|
||||||
for j in range(self.tiles_x):
|
for j in range(self.tiles_x):
|
||||||
#od liczby zależy jaki teren, np. 0 - piasek
|
#od liczby zależy jaki teren, np. 0 - piasek
|
||||||
if randrange(10)==0:
|
rng = randrange(10)
|
||||||
|
if rng==0:
|
||||||
matrix[i].append(10)
|
matrix[i].append(10)
|
||||||
|
elif rng<2:
|
||||||
|
matrix[i].append(0)
|
||||||
|
cliff = Cliff(j,i,self.tile_size, randrange(4)*90)
|
||||||
|
#self.cliffs.append(cliff)
|
||||||
else:
|
else:
|
||||||
matrix[i].append(0)
|
matrix[i].append(0)
|
||||||
self.terrain_matrix = matrix
|
self.terrain_matrix = matrix
|
||||||
@ -83,6 +112,8 @@ class Map:
|
|||||||
def draw_objects(self):
|
def draw_objects(self):
|
||||||
for mine in self.mines:
|
for mine in self.mines:
|
||||||
mine.draw(self.window.window)
|
mine.draw(self.window.window)
|
||||||
|
for cliff in self.cliffs:
|
||||||
|
cliff.draw(self.window.window)
|
||||||
|
|
||||||
|
|
||||||
#saper
|
#saper
|
||||||
|
Loading…
Reference in New Issue
Block a user