Uses a background image for to render walls
Add background images and transparent tile Use transparent tile to see background Maybe do not use tiles for wall (perf?)
This commit is contained in:
parent
0c954f53ee
commit
9c7ad6ccf0
BIN
img/brick-800.png
Normal file
BIN
img/brick-800.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 210 KiB |
BIN
img/rock-800.png
Normal file
BIN
img/rock-800.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 324 KiB |
BIN
img/transp-30.png
Normal file
BIN
img/transp-30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
BIN
img/transp-50.png
Normal file
BIN
img/transp-50.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 B |
BIN
img/zebra-800.png
Normal file
BIN
img/zebra-800.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
10
main.py
10
main.py
|
@ -21,11 +21,12 @@ from map import Map, MAZE_ELEMENTS, MAZE_SIZE
|
|||
CELL_SIZE_PX = 30
|
||||
|
||||
MAZE_ELEMENTS_TILES = {
|
||||
'wall': 'img/zebra-30.png',
|
||||
'wall': 'img/transp-30.png',
|
||||
'exit': 'img/g-orange-transp-30.png',
|
||||
'plyr': 'img/player-30.png',
|
||||
'void': 'img/blue-transp-30.png'
|
||||
'void': 'img/blue-white-30.png'
|
||||
}
|
||||
BACKGROUND_IMG = 'img/brick-800.png'
|
||||
UNKNOWN_TILE = 'img/unknown-30.png'
|
||||
MAP_FILE = '01.map'
|
||||
|
||||
|
@ -38,6 +39,9 @@ pygame.init()
|
|||
WINDOW = pygame.display.set_mode(
|
||||
(WINDOW_SIZE_PX, WINDOW_SIZE_PX), RESIZABLE
|
||||
)
|
||||
BACKGROUND = pygame.image.load(BACKGROUND_IMG).convert()
|
||||
WINDOW.blit(BACKGROUND, (0, 0))
|
||||
|
||||
# Loading map
|
||||
MAP_GAME = Map(MAP_FILE)
|
||||
|
||||
|
@ -48,7 +52,7 @@ for cell, element in enumerate(MAP_GAME.map_print().replace('\n', '')):
|
|||
|
||||
if key in MAZE_ELEMENTS_TILES:
|
||||
back_tiles.append(
|
||||
pygame.image.load(MAZE_ELEMENTS_TILES[key]).convert()
|
||||
pygame.image.load(MAZE_ELEMENTS_TILES[key]).convert_alpha()
|
||||
)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user