pstrejczek Posted April 25, 2018 Share Posted April 25, 2018 How do I actually use modules ? I have created a module and moved a class there, how I can use this class in my game.main ? I have not found any examples or info in docs how to do that. Quote Link to comment Share on other sites More sharing options...
pstrejczek Posted April 26, 2018 Author Share Posted April 26, 2018 Ok. I have figured it out. You have to do .require('game.module_name') before .body in the main module. To create the object of class which is located in separate module you simply use new game.class_name. Quote Link to comment Share on other sites More sharing options...
enpu Posted April 30, 2018 Share Posted April 30, 2018 @pstrejczek Sorry for the delay, i just added short tutorial on how to create and use modules: https://www.panda2.io/tutorials/module pstrejczek 1 Quote Link to comment Share on other sites More sharing options...
greencoder Posted March 26, 2020 Share Posted March 26, 2020 For some reason, this does not work as explained. When I try to save a module, it asks me for the location to save, I tried saving it in game and plugin folders but then module view doesn't filter also. I guess I am missing something here. Quote Link to comment Share on other sites More sharing options...
enpu Posted March 26, 2020 Share Posted March 26, 2020 Ah small mistake there. You need to first require the new module, before it appears in the modules tab. Quote Link to comment Share on other sites More sharing options...
greencoder Posted March 26, 2020 Share Posted March 26, 2020 Ahha, worked! Thanks @enpu and welcome back! 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.