Description

GLEED2D (Generic LEvel EDitor 2D) is a general purpose, non tile-based Level Editor for 2D games of any genre that allows arbitrary placement of textures and other items in 2D space. Levels are saved in XML format. Custom Properties can be added to the items in order to represent game-specific data/events/associations between items etc.

http://gleed2d.codeplex.com

This class reads the XML file generated by Gleed2d to insert into CanvasEngine

Example

var canvas = CE.defines("canvas_id").
extend(Gleed2d).
ready(function() {
    canvas.Scene.call("MyScene");
});

canvas.Scene.new({
    name: "MyScene",
    materials: {
        images: {
            img1_id: "path/to/img1.png",
            img2_id: "path/to/img2.png"
        }
    },
    ready: function(stage) {
        var self = this;
        this.layer = null;
        this.element = this.createElement();

        // -- Gleed2d Level
        var gleed = canvas.Gleed2d.new();
        gleed.ready(function() {
            self.layer = this.getLayer("background");
        });
        gleed.load(this, element, "data");
        // --

        stage.append(this.element);
    },
    render: function(stage) {
        this.layer.x -= 2;
        stage.refresh();
    }
});

Methods

load

Load an XML file and builds layers of the elements. Calls the method "ready" of this clas after the construction of the elements.

change

Allows you to change the parameters of an element in the construction layers

ready

Calls the callback function at the end of the construction elements (loading and layers)

getLayer

Retrieve a layer according to its name

Discussion