Home > Video Games > Tiled Maps for XNA – Full support for the Tiled Map XML specification!

Tiled Maps for XNA – Full support for the Tiled Map XML specification!

July 14th, 2009

So yesterday I came across a very basic loader for Tiled Maps (*.tmx) made with the Tiled Map Editor. It only supported the basics–Tileset loading and Layer rendering–so I took it upon myself to complete the loader by adding support for the rest of the features that were left out;

-added ProhibitDtd = false, so you don’t need to remove the doctype line after each time you edit the map.
-changed everything to use SortedLists for named referencing–so much easier
-added objectgroups
-added movable and resizable objects
-added object images
-added meta property support to maps, layers, object groups and objects
-added support for non-binary encoded layer data
-added layer and object group transparency

I created a simple demo to show off some of the features. You should see a partially transparent object with a resized image of Ness (Earthbound) on top of a partially transparent layer of grass with the words “Tile Maps Rule” written in rock with a pulsating opacity. Use the arrow keys to move Ness around. All objects and object groups can have their X and Y coordinates set dynamically, so you can do cool stuff like parallax clouds drifting overhead.

Download the Tiled Maps Loader

  • Digg
  • StumbleUpon
  • Technorati
  • Reddit
  • Furl
  • del.icio.us
  • Google Bookmarks
  • Slashdot
  • Facebook
  • MySpace
  • LinkedIn

Video Games

  1. michi
    July 23rd, 2009 at 15:45 | #1

    Hello

    I didn’t get the transparency working…are you sure you implemented it?

    Ich made a map with one layer und in the tileset i can see that there are some transparents tiles, so i choose the right color while i imported the tileset

    but when i use this map in your example, than the tiles are purple and not trancparency

    can you help me?

    thx

  2. July 23rd, 2009 at 16:00 | #2

    That’s part of the tileset file, not the map file. I don’t have any support for tileset files yet. I might do that later.

  3. michi
    July 24th, 2009 at 03:52 | #3

    hmm

    what about this new feature: “-added layer and object group transparency” ?

    hmm in the map file there is a node e.g. “trans=ff00ff” in the same line where the tileset source is.
    michi´s last blog ..GMX Lottozahlen My ComLuv Profile

  4. July 24th, 2009 at 10:27 | #4

    That’s referring to the opacity setting that can be set on each layer or object group using the slider above the layer list.

  5. michi
    July 25th, 2009 at 09:29 | #5

    ok now i got it.

    hmm, maybe i make a transparentcy extension.

    so that the color which is defined in the editor as trancparent

  1. July 14th, 2009 at 17:13 | #1
CommentLuv Enabled

Bad Behavior has blocked 277 access attempts in the last 7 days.