commit 5d90f719cbd1e6807ec6ecc4ba93032885e90871 Author: Jakub Sztuba Date: Mon Mar 7 10:08:53 2022 +0100 Add tilemap diff --git a/cafe.tmx b/cafe.tmx new file mode 100644 index 0000000..81dba74 --- /dev/null +++ b/cafe.tmx @@ -0,0 +1,31 @@ + + + + + + + + +1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,6, +7,8,10,10,8,8,8,10,10,8,8,8,10,10,8,8,8,10,8,12, +13,10,16,17,10,8,10,16,17,10,8,10,16,17,10,8,10,9,10,18, +13,8,10,10,8,8,8,10,10,8,8,8,10,10,8,8,8,10,8,18, +7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,12, +7,8,10,8,8,10,8,8,10,8,8,10,8,8,10,8,8,10,8,12, +7,8,9,8,8,9,8,8,9,8,8,9,8,8,9,8,8,9,8,12, +7,8,10,8,8,10,8,8,10,8,8,10,8,8,10,8,8,10,8,12, +13,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,18, +13,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,18, +7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,12, +7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,12, +7,8,10,8,8,8,10,8,8,8,8,8,8,10,8,8,8,10,8,12, +7,10,9,10,8,10,9,10,8,8,8,8,10,9,10,8,10,9,10,12, +7,8,10,8,8,8,10,8,8,8,8,8,8,10,8,8,8,10,8,12, +13,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,18, +13,8,10,8,8,8,10,8,8,8,8,8,8,10,8,8,8,10,8,18, +7,10,9,10,8,10,9,10,8,8,8,8,10,9,10,8,10,9,10,12, +7,8,10,8,8,8,10,8,8,8,8,8,8,10,8,8,8,10,8,12, +25,27,27,27,27,27,27,27,27,28,29,27,27,27,27,27,27,27,27,30 + + + diff --git a/cafe1.tsx b/cafe1.tsx new file mode 100644 index 0000000..528ed65 --- /dev/null +++ b/cafe1.tsx @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tiles.py b/tiles.py new file mode 100644 index 0000000..3bb2f5f --- /dev/null +++ b/tiles.py @@ -0,0 +1,29 @@ +import pygame +import pytmx + +pygame.init() + +display = pygame.display.set_mode((640,640)) +clock = pygame.time.Clock() + +gameMap = pytmx.load_pygame("cafe.tmx") + +while(True): + + clock.tick(60) + keys = pygame.key.get_pressed() + + for event in pygame.event.get(): + if(event.type == pygame.QUIT): + quit() + + if(keys[pygame.K_ESCAPE]): + quit() + + for layer in gameMap.visible_layers: + for x, y, gid, in layer: + tile = gameMap.get_tile_image_by_gid(gid) + if(tile != None): + display.blit(tile, (x * gameMap.tilewidth, y * gameMap.tileheight)) + + pygame.display.update() \ No newline at end of file