2022-04-23 19:14:23 +02:00
|
|
|
from map import map_utils
|
|
|
|
from map import map_pattern
|
|
|
|
import pygame as pg
|
|
|
|
from settings import *
|
|
|
|
|
|
|
|
def get_tiles():
|
2022-04-29 11:01:16 +02:00
|
|
|
array = map_utils.generate_map()
|
|
|
|
# array = map_utils.get_blank_map_array()
|
2022-04-24 19:05:48 +02:00
|
|
|
|
2022-04-29 11:01:16 +02:00
|
|
|
# array[1][1] = 1
|
|
|
|
# array[1][2] = 1
|
|
|
|
# array[1][3] = 1
|
|
|
|
# array[1][4] = 1
|
|
|
|
# array[1][5] = 1
|
|
|
|
# array[1][6] = 1
|
2022-04-24 19:05:48 +02:00
|
|
|
|
2022-04-29 11:01:16 +02:00
|
|
|
# array[2][5] = 1
|
2022-04-24 19:05:48 +02:00
|
|
|
|
2022-04-23 19:14:23 +02:00
|
|
|
pattern = map_pattern.get_pattern()
|
|
|
|
tiles = map_utils.get_sprites(array, pattern)
|
2022-04-23 19:30:06 +02:00
|
|
|
return tiles, array
|
2022-04-23 19:14:23 +02:00
|
|
|
|
|
|
|
def render_tiles(tiles, screen, camera, debug=False):
|
|
|
|
for tile in tiles:
|
|
|
|
screen.blit(tile.image, camera.apply_rect(tile.rect))
|
|
|
|
if debug:
|
|
|
|
pg.draw.rect(screen, RED, camera.apply_rect(tile.rect), 1)
|