Jump to content

upgrading old code to new version


Hashasm
 Share

Recommended Posts

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.

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...