GLEED2D level loading system for libgdx

Update: the system had been moved into the official libgdx repository as an extension but then it was removed. Gleed doesn’t support basic features such as relative paths for textures.

I”m happy to announce that I’ve made my first contribution to a relatively big open source project. I feel honoured to contribute to the brilliant libgdx framework with these humble loader and renderer for GLEED2D levels. Hold on, what the hell is that? Please, read on.

About GLEED

GLEED2D is a non tiled based open source general purpose level editor. You can place textures and shapes, rotate and scale them. As usual, elements are laid in layers and it is also possible to add custom properties which makes it adequate for all kinds of purposes. Level are saved in an easy to parse XML format. It’s based on XNA 3 but XNA 4 and Mono versions are on the works. What’s good aboutGLEED2D is that it allows you to create smooth levels in a very nice way. Shapes can be used to define collision areas, triggers and so on.

This means you can set a few rules and conventions of your own and be able to fire up scripts, set the player spawn point and all sorts of level design sweetness.

gleed-editor.png

Features

Possible improvements

gleed-level-ingame.jpg

Usage

When creating the level you need to specify the textures root folder or atlas file as a top level custom property:

// Set loader in the Asset manager
m_assetManager.setLoader(Level.class, new LevelLoader(new InternalFileHandleResolver()));

...

// Tell the manager to load the level
m_assetManager.load("data/braidtest.xml", Level.class);

...

// When it's ready, fetch the level and create renderer
m_level = m_assetManager.get("data/braidtest.xml", Level.class);
m_levelRenderer = new LevelRenderer(m_level, null, Game.mpp);

...

// Render all layers
m_levelRenderer.render(m_camera);

However, if you get lost, there are Javadoc comments everywhere in the code.

Where do I get it?

It should be soon in the libgdx nightly builds but if you”re really eager to use it and can’t wait any longer (seriously?) you can go to the libgdx repository and find it in the extensions section. Remember to leave some feedback of any flavour: rotten tomatoes, rocks and so on and so forth.

comments powered by Disqus