Sign in to follow this  
Followers 0
Hashasm

upgrading old code to new version

5 posts in this topic

Without seeing and knowing the code in the file or even MelonJs, the first thing to do is to update your local repository of MelonJs where you downloaded it.

And then you check the docs of the new version of Melonjs and go part by part and update your file which depends on Melonjs.

But there is no chance I or any other will go trough that 560 lines file and debug it for the code you have.

Learn the file internally how it works and then add changes appropriatelly.

Also when this sort of thing happens, and you need to update existing code to a newer version of a tool used in it, I would use source code versioning system, like SVN/VisualSVN/TortoiseSVN or Git/Github with Git shell installed locally. This will help you save the current version of the file and also save the upcomming changes. And will enable you to revert back some of the changes to a previous version.

obiot likes this

Share this post


Link to post
Share on other sites

we have a wiki page that we maintain on this purpose :

https://github.com/melonjs/melonJS/wiki/Upgrade-Guide

also, there is some good upgrade guide made by Cian Games (unfortunaly they stop at version 2.x though) :

http://blog.ciangames.com/2014/08/upgrading-to-melonjs-10.html

http://blog.ciangames.com/2014/09/upgrading-to-melonjs-11.html

http://blog.ciangames.com/2014/11/upgrading-to-melonjs-20.html

http://blog.ciangames.com/2015/05/upgrading-to-melonjs-21.html

 

and generally speaking I would definitely check our wiki page, as it contains tons of informations and how-to on various topics (especially the 3rd-party tools section)  :

https://github.com/melonjs/melonJS/wiki

spinnerbox likes this

Share this post


Link to post
Share on other sites

yeah 

thanks for the links i already surf through wiki pages  but i didt find newer version method like

// Old Code -> New Code
me.game.remove -> me.game.world.removeChild
me.game.add -> me.game.world.addChild
me.game.collide -> me.game.world.collide
me.game.getEntityByProp -> me.game.world.getChildByProp
me.save.delete -> to me.save.remove
me.entityPool.newInstanceOf -> me.pool.pull
me.entityPool.add -> me.pool.register
me.Rect.set -> me.Rect.setShape
me.Font.set -> me.Font.setFont

this so i struck .

thanks

Share this post


Link to post
Share on other sites

That's an oversimplification of some of the changes that have been made. Don't expect to just rename functions and have things work. The arguments type, order, and other requirements can also change. The Upgrade Guide is the best place to get the full picture of how the engine has evolved over time, and how you can adapt old code to the newer engine.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.