elsioneto Posted May 9, 2014 Share Posted May 9, 2014 I`m currently using phaser 2.0.2 and I implemented some states transitions on my game due to load issues. Before the transitions, the game was working fine, now, some methods aren`t working, such "revive"on the sprites, and every time I instantiate some image or sprite the "game" property on it comes null. Does anyone knows something about it? Link to comment Share on other sites More sharing options...
rich Posted May 9, 2014 Share Posted May 9, 2014 Don't think there's enough information here to even know where to start, sorry. Link to comment Share on other sites More sharing options...
elsioneto Posted May 9, 2014 Author Share Posted May 9, 2014 Hmm, ok i'll try to be more clear I had a game working fine, with some menu, levels and etc... But I was loading everything at once in the PreLoader, and that was making the loading very slow. So I planned to use a state for each level with it's own PreLoader and Create, so I subdivided every asset needed to load by level. but some things just don't work anymore when I try to load de first level(quiting from the "Menu"state and starting de "Level1"state). making a debug, it seems that some properties on the objects that Phaser automatically sets, it's not setting anymore. For example, every sprite or image comes with "game" property, pointing to the game created (Phaser.Game(params)) , but now it's not coming anymore(in the 'Level1' state). And it's happening series of errors (if I try to revive an image a get a 'Uncaught TypeError: Cannot read property 'length' of undefined' ). Hope it were more clear this time... Link to comment Share on other sites More sharing options...
Manifest Posted May 11, 2014 Share Posted May 11, 2014 I've had similar issues - usually it's due to adding an object to the wrong parent or something like that. I suggest you put a conditional breakpoint on the phaser.js line in question in Chrome's debugging tools. That will tell you at least what is undefined, and you will be able to give us more information. To clarify, if the line it's breaking on has "children.length" then put a conditional breakpoint of with the condition "children == undefined". elsioneto 1 Link to comment Share on other sites More sharing options...
elsioneto Posted May 15, 2014 Author Share Posted May 15, 2014 I`ve managed to make it work here. On the mobile template there is a class just do make the preload (Preloader.js). To make the dynamic preload, i've used the Game.js preload. Link to comment Share on other sites More sharing options...
Rocco Posted May 15, 2014 Share Posted May 15, 2014 that's great for you, but unfortunatly not for us.So maybe you can provide a little example how you make a dynamic preload inside game.js? Link to comment Share on other sites More sharing options...
Recommended Posts