Jump to content

Writing plugins for MightyEditor

Recommended Posts



I was thinking of writing a plugin for MightyEditor that can be used to create dynamic characters with swappable body parts, clothing and so on. System is pretty much ready and works nicely inside my main state, but I am new to Phaser plugin writing in general as well, so is there anything I need to take into account if I am using special features of the MightyEditor, like movies and mt.create?


I did manage to create a normal plugin following http://www.emanueleferonato.com/2014/09/08/phaser-tutorial-creating-your-own-phaser-plugins/ this tutorial, but now with my own code it throws Uncaught TypeError: Cannot set property 'game' of undefined.

Link to post
Share on other sites

You should be able to use any Phaser plugin in your game.


Maybe you are getting error because ME default template don't expose game globally, but you can modify main.js 9th line: to

// expose game as global variablewindow.game = this.game = new Phaser.Game...

in ... leave default parameters as is. e.g. (mt.data.map.viewportWidth, mt.data.map.viewportHeight, Phaser.AUTO, document.body, window.Racer.state.boot)

there namespace is Racer - replace with your own


and see if that fix error.


If that don't help, I will need code fragments that produce error to be more helpful. 

Link to post
Share on other sites

it would be nice to have an option in ME to load plugin automatically and plugin could add context menu to groups / sprites - "add character animations" or something like that.

If you are interested in such option - I could create API to load external plugins directly in ME, then plugins could add new context menus or panels etc :)

Link to post
Share on other sites

That would be awesome! I am quite new to Phaser and ME, so I need to think a bit what could be the possibilities. At least having some custom error messages, possibility to make a base skeleton and the group structure and such would be cool. Also we did some .AI scripts for our project that output .json and sprites automatically for Phaser, so integrating those would be the ultimate dream. :D

Link to post
Share on other sites

if you are interested - you can check plugins folder. e.g. this is pretty simple plugin: https://github.com/TheMightyFingers/mightyeditor/blob/master/client/MT/plugins/UserData.js


in the meantime - I will add simple plugin manager to load custom plugin (scripts) and create documented mt.api - with most common functions: e.g. addPanel, addInput etc.


probably ( I'm pretty bad with estimates :) ) tomorrow I'll be able to show initial version with small demo plugin

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...