how to make Rect with pytmx layers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to make Rect with pytmx layers

i got pytmx to blit all the layers for now, but i can't figure out how to deal with layers, for now i only got 2 layers, one i want to blit and be Rects and the other i just want it to blit import pygame import pytmx pygame.init() W, H = 800, 400 FPS = 60 win = pygame.display.set_mode((W, H), 0, 32) pygame.display.set_caption('trying to make this work somewhow') game_map = pytmx.load_pygame('map/map.tmx') clock = pygame.time.Clock() run = True while run: clock.tick(FPS) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False win.fill((146, 244, 200)) tiles = [] for layer in game_map.visible_layers: for x, y, gid, in layer: tile = game_map.get_tile_image_by_gid(gid) if tile: win.blit(tile, (x * 16, y * 16)) pygame.display.update() pygame.quit()

10th Sep 2021, 8:23 PM
Tomoe
Tomoe - avatar
2 Answers
10th Sep 2021, 9:42 PM
SoloProg
SoloProg - avatar
0
SoloProg I've already went through all of those, they really don't explain much, there aren't exactly any tutorials of pytmx
10th Sep 2021, 10:20 PM
Tomoe
Tomoe - avatar