Git Product home page Git Product logo

tiled.net's Introduction

Tiled.Net

A .NET library for reading Tiled maps.

Attention: This library is no longer being supported. Check out TiledSharp for another library that reads Tiled maps.

About Tiled.Net

Tiled.Net provides a general way of reading and writing TMX (Tiled Map XML) files. Tiled.Net aims to be usable everywhere, rather than being tied to things like XNA/MonoGame and Unity.

Tiled.Net should be compatible with the official format, which can be viewed here.

Usage

  • Add the using statement
using Tiled;

Reading a Map File

  • Create a new TiledMap object
var map = new TiledMap("my-map.tmx");

Accessing Layers

var layer = map.Layers[0] as TiledTileLayer;
// or
var layer = map["My Layer"] as TiledTileLayer;
...
var layerName = layer.Name;
...

Creating a Map File

  • Create a new TiledMap object and initialize any necessary properties
var map = new TiledMap
{
    TileWidth = 16,
    TileHeight = 16,
    Layers = new List<TiledBaseLayer>
    {
        new TiledTileLayer
        {
            Name = "Foreground"
        }
    }
    ...
};
  • Save the map to a file
// Save the map to be _readable_.
map.Save("my-map.tmx");

// Save the map to be _compact_.
map.SaveCompact("my-map.tmx");

tiled.net's People

Contributors

napen123 avatar

Watchers

 avatar

tiled.net's Issues

Per-tile images

Hi! In my current project, I'm planning on adding a build step that puts multiple tile images together into one tileset texture. Tiled supports this feature since version 0.9 according to the spec. This is done by omitting the <image> element from <tileset> and providing one for each <tile> instead. I'd like to use this library for loading tilesets and maps, but this is the one thing missing before I can do so.

As far as I know, this would only require adding a field to TiledTile. Something like

/// <summary>
/// Defines the individual tile's image.
/// </summary>
[XmlElement("image")]
public TiledImage Image;

/// <summary>
/// Nothing to see here. Used for serialization.
/// </summary>
/// <returns></returns>
public bool ShouldSerializeImage()
{
    return Image != null;
}

I can open a pull request when I get home if you're interested in this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.