How to use the pytmx.load_pygame function in PyTMX

To help you get started, we’ve selected a few PyTMX examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukeshorejones / rpg-test / map.py View on Github external
def __init__(self, filename):
        tm  = pytmx.load_pygame(filename, pixelalpha=True)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm
        self.matrix = [[0 for x in range(tm.width)] for y in range(tm.height)]
        self.blue_spawns = []
        self.red_spawns = []
github bitcraft / pyscroll / tests / demo-2x.py View on Github external
def __init__(self, filename):
        self.init_buffer([screen.get_width() / 2, screen.get_height() / 2])

        tmx_data = pytmx.load_pygame("desert.tmx")
        map_data = pyscroll.TiledMapData(tmx_data)
        self.map_layer = pyscroll.BufferedRenderer(map_data, self.buffer_size)

        f = pygame.font.Font(pygame.font.get_default_font(), 20)
        t = ["scroll demo. press escape to quit",
             "arrow keys move"]

        self.text_overlay = [f.render(i, 1, (180, 180, 0)) for i in t]
        self.center = [self.map_layer.width/2,self.map_layer.height/2]
        self.camera_vector = [0, 0, 0]
        self.running = False
github kidscancode / gamedev / dash / dash.py View on Github external
def __init__(self, filename):
        tm = pytmx.load_pygame(filename, pixelalpha=True)
        self.size = tm.width * tm.tilewidth, tm.height * tm.tileheight
        self.tmxdata = tm
github APFGIH / Astrophysics-For-Gamers-in-a-Hurry / Map / Map.py View on Github external
def __init__(self, gameScreen):
        self.gameMap = pytmx.load_pygame("Map/tileMaps/world.tmx", pixelalpha=True)
        self.width = self.gameMap.width
        self.height = self.gameMap.height
        self.screenSize = gameScreen.get_size()
        self.tileSize = 48
        self.collisionRects = []
        self.minigamePortal = []
        self.informationTiles = []
        self.destinations = {}
        self.universities = []
        self.teleports = []
        self.npc = []

        self.bank = []
        self.slotmachine = []

        for r in self.gameMap.get_layer_by_name("Collision"):
github kidscancode / gamedev / tutorials / tilemap / working / tilemap.py View on Github external
def __init__(self, filename):
        tm = pytmx.load_pygame(filename, pixelalpha=True)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm