pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Tiled TMX Loader

Tiled TMX Loader - v.15

Leif Theden (bitcraft)

Tags:

Description

Map loader for TMX Files
bitcraft (leif dot theden at gmail.com)
v.15 - for python 2.7

If you have any problems or suggestions, please contact me via email.
Tested with Tiled 0.8.0 for Mac.

released under the LGPL v3


===============================================================================

This map loader can be used to load maps created in the Tiled map editor.  It
provides a simple way to get tiles and associated metadata so that you can draw
a map onto the screen.

This is *not* a rendering engine.  It will load the data that is necessary to
render a map onto the screen.  All tiles will be loaded into in memory and
available to blit onto the screen.


Design Goals:
    Simple api
    Memory efficient and fast

Features:
    Loads data and "properties" metadata from Tile's TMX format
    "Properties" for: maps, tilesets, layers, objectgroups, objects, and tiles
    Point data for polygon and polyline objects
    Automatic flipping and rotation of tiles
    Supports base64, csv, gzip, zlib and uncompressed XML
    Image loading with pygame


===============================================================================

Please see tmxloader.py's docstring for version information and sample usage.
Check tests/test.py and tests/demo.py for examples on how to use the library.


===============================================================================

The 16x16 overworld tiles were created by MrBeast at opengameart.org. CC-BY 3.0

Changes

New in .15:
    loader: fixed issue where objects with tile gid did not load properties
    loader: polygon and polyline objects
    loader: new lookup methods use iterators
    loader: loading function moved into classes
    loader: data/images can be reloaded on the fly
    loader: uses etree for faster xml parsing

Links

Home Page: https://github.com/bitcraft/PyTMX
Source: https://github.com/bitcraft/PyTMX

Screenshot


click to view original size

Releases

Tiled TMX Loader - v.15 - May 31, 2012
Tiled TMX Loader - v.14 - May 10, 2012
Tiled TMX Loader - v.13 - Mar 20, 2012
Tiled TMX Loader - v.11 - Feb 20, 2012

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

December 8, 2011 10:50pm - Leif Theden - nickname: (bitcraft)
milleja46: i cannot test this on python 3.x.
November 15, 2011 2:48pm - Josh Miller - nickname: (milleja46)
Still doesn't work...the import of it works fine.
The problem is doing "tiledmap = tmxloader.load_pygame("test.tmx")" it reports a error with str and bytes which shouldn't happen since test.tmx is a filename...(this is the python 3 version you gave me)
November 1, 2011 3:13pm - Leif Theden - nickname: (bitcraft)
@milleja46 I am not able to reproduce this, but I realize what caused it. I'll have a fixed version up soon. Thanks for the report.
October 31, 2011 10:15am - Josh Miller - nickname: (milleja46) - 2/5
I try and run it and i get:
"Traceback (most recent call last):
File "E:\Documents\gameEngine\gameEngine.py", line 5, in <module>
import tmxloader
File "E:\Documents\gameEngine\tmxloader.py", line 136
except IndexError, ValueError:
^
SyntaxError: invalid syntax"

So it doesn't work and i've not even tried using a map made in tiled o_o
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Jul 22, 2014

Jul 21, 2014


Jul 20, 2014

Jul 19, 2014

Jul 15, 2014

Jul 10, 2014

Jul 9, 2014

Jun 27, 2014



Jun 24, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)