melonJS 0.9.2

December 31, 2011

melonJS 0.9.2 available !

I’m happy to anounce that melonJS 0.9.2 is now officially available for download.

There is no real revolution inside, but a lots of nice features an improvement that will make everybody’s life easier (multiple line spritesheet/fontsheet, friction management, code optimization, better documentation, etc…). Some of them are also based on feedbacks or help of some of you (scan, Ben2303, Anthony, Lucas to name a few), so thank you very much !

Please see the full changelog on github for more details on this new version, and also the online documentation. And as previously, everything is available through the melonJS download page.

Additionally, and as explained in my last post, the biggest changes is maybe that melonJS is now released under the terms of The MIT license. This is a popular, human-readable and simple license, that everybody knows and understand, and I believe that most of you will be happy about it.

Please also don’t hesitate to step by the melonJS forum and say hello 🙂

Updating your game to work with melonJS 0.9.2 :

Following a few API changes in this new version, here is a couple of tips to ease the upgrade from a previous version of melonJS.

 1/Check for player movement :

-> In the previous version of melonJS, the updateMovement() function was returning a Boolean, indicating if your player movement has changed (final velocity different from 0) :

// check & update player movement
var updated = this.updateMovement();
// update animation if updated
if (updated)
   // update objet animation
   return true;
return false;

-> In the 0.9.2 version of melonJS, the updateMovement() function now returns a collision “vector”, giving you indication on how you collided with the environment (the level itself, not other entities). Assuming that you don’t need that information, if you just want to upgrade you existing game, the simple solution is to do the following :

// check & update player movement
// update animation if updated
if (this.vel.x!=0 || this.vel.y!=0)
   // update objet animation
   return true;
return false;

As you can see, we replace the “updated” variable by a check on (this.vel.x!=0 || this.vel.y!=0), and since this what was returned by the updateMovement in the previous version, it gives us exactly the same behavior.

2/fadeIn/fadeout effect :

in melonJS 0.9.2, the fade effect are now taking as input a duration in ms, where it was in framecount for the previous version :

before :

// set a fade transition effect
me.state.transition("fade","#000000", 30); // 30 frame

now :

// set a fade transition effect
me.state.transition("fade","#000000", 500); // 500ms

One last word : let’s eat some fish !

And finally I’ve been working on this demo. I had lots of questions about “is it possible to do something else than a platform  games with melonJS?”, so I did something else ! it’s not at the stage I wanted to (it missing a few points to make it really nice), but I will update it later.

So, in a few words :

– it’s a fish game (woow!)
– the main player control the big fish
– you must eat the small fish to survive (or your life bar will keep decreasing)
– the more fish you eat, the bigger you become, making it more harder to avoid the jellyfish
– if you are too big, you can fart to get smaller. you can also fart on the jellyfish to kill them.

The demos is here : www.melonjs.org/demos/fishwar/

Have a fun !



  1. Great work ! Many nice additions (especially multiline sprite sheets which help a lot using other people’s sprites :p)
    I’m a little ashamed to appear in the credits, my contribution is now outdated and incomplete :/
    Like so many people around here, time is seriously lacking, hope this year will give us more time 😉
    Happy New Year !

  2. Well done! So far I’ve got a level map up, no player yet. I would recommend including “gameobj.js” in the tutorial zip as well as giving a bit more detailed instructions for using “–disable-web-security” ans/or “–allow-file-access-from-files” parameters in Chrome – not common knowledge for many people.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: