N3RD Posted August 19, 2015 Share Posted August 19, 2015 Hello again,Is there a way to import external classes?I come from a OOP Background and would like to split classes into single files.The reason being its alot nicer and cleaner to have multiple smaller classes thanhaving 1 Main class which is 1000+ lines long. example:Main.jsObj1.jsObj2.jsetc.....Is the termonoligy here with panda.js Module instead of class?If possible what would the implementation be?Thank you!N3RD Quote Link to comment Share on other sites More sharing options...
LinkTree Posted August 19, 2015 Share Posted August 19, 2015 Yes what you are looking for is Modules. You use them like this: src/game/object1.js:game.module('game.object1').require(// module dependencies// 'game.object2',// 'game.object3').body(function() {// your code game.createClass('className', { init: function(arg1,arg2) { }});you are not limited to src/game/ you can also have src/plugins/, src/functions/ and so on. and you call them like this:game.module('directory.filename','directory1.directory2.filename2') N3RD and goide 2 Quote Link to comment Share on other sites More sharing options...
N3RD Posted August 19, 2015 Author Share Posted August 19, 2015 Thank you LinkTree! You Rock! Quote Link to comment Share on other sites More sharing options...
LinkTree Posted August 19, 2015 Share Posted August 19, 2015 You're welcome. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.