Ninjadoodle Posted June 25, 2014 Share Posted June 25, 2014 Hi Guys If I add all my images into an assets.js file and 'require' the file, does this mean that all the images get loaded when the game starts? Wouldn't this cause a huge spike in memory use on mobiles. What would be a better way of loading assets for different levels. Could I have multiple asset files ... Level1Assets.jsLevel2Assets.jsand so on ... and then load them in each level? What would be the best way of going about this? Thank you heaps in advance! Quote Link to comment Share on other sites More sharing options...
enpu Posted June 26, 2014 Share Posted June 26, 2014 You don't have to load all assets, when game starts. Use loader's dynamic mode: http://www.pandajs.net/snippets/9adc8186791129fc59c4.html Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted June 26, 2014 Author Share Posted June 26, 2014 Hi enpu Thanks for an awesome engine! I really like it I tried using the dynamic loader, but when I change between scenes and go back to the level, it tells me that the asset has already been declared/exists. I might be doing something wrong. Quote Link to comment Share on other sites More sharing options...
Apathy Posted June 26, 2014 Share Posted June 26, 2014 I also have such a problem. It seems that even in dynamic mode the assets are kept in the memory even after the scene changes so you get that error when reloading them. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted July 3, 2014 Author Share Posted July 3, 2014 HI Guys I've managed to find a way around revising a level with dynamic loaded assets, but I don't think it solves the memory issue. Make a global variable and check it to make sure you are only loading the assets on the first play through. Set the global var to true once the assets have been loaded. This allows you to revisit the level avoiding the message/crash that the assets already exits. The problem is that the assets stay in memory which might eventually result in a memory crash (on weaker devices). Is this a possible bug, or are we doing something wrong? Is there a way to unload assets before switching to the next scene? Thanks heaps in advance! 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.