Sprite

To initialize a sprite which has been placed on the game map, like in the image below,

 

you must first go to the Source Editor.

And in the source editor in the create method of your chosen state (menu in this case) add this:

"use strict";
window.Sprites.state.menu = {
    create: function() {
        //use mt.create here for example
        this.wall = mt.create("bg_wall");
        this.chest = mt.create("chest");
        this.box = mt.create("box_simple");

    },

    update: function() {

    }
};

The mt.create function is used to initialize the sprites  (remember to initialize objects in the background before those in the foreground).


Sample is available here.

Leave a Reply

Your email address will not be published. Required fields are marked *