Mike Posted September 15, 2013 Share Posted September 15, 2013 Well i'm updating old Phaser code to 1.0 Well some renaming and function moved to new objects and so on I'm a bit stuck here:function preload() { myGame.world.setSize(320, 416); myGame.load.image('logo', 'assets/images/logo.png'); myGame.load.image('bg', 'assets/images/bg_prerendered.png'); myGame.load.atlasJSONArray('tiles', 'assets/textureAtlas/breakout.png', 'assets/textureAtlas/breakout.json');}function create() { myGame.add.sprite(0, 0, 'bg'); paddle = myGame.add.sprite(myGame.world.width / 2, myGame.world.height - 48, 'tiles'); paddle.animations.add('paddle_big', ['paddle_big.png'], 10, false, false); paddle.animations.add('paddle_small', ['paddle_small.png'], 10, false, false);}And the error that hit's me is : Uncaught TypeError: Cannot read property 'uuid' of null phaser.js:20495 Phaser.AnimationManager.addphaser.js:20495 creategame.js:277 Phaser.StateManager.loadCompletephaser.js:7851 Phaser.Game.loadCompletephaser.js:10273 Phaser.SignalBinding.executephaser.js:8426 Phaser.Signal.dispatchphaser.js:8312 dispatchphaser.js:8115 Phaser.Loader.nextFilephaser.js:23026 Phaser.Loader.jsonLoadCompletephaser.js:22920 _xhr.onload What i checked is that: paddle.animations.add('paddle_big'); - works, but there isn't a frame name specified paddle.animations.add('paddle_big', [1], 10, false, false); - agian works but is hard to tell what frame is 1,2,3, etc. So I suppose that there is new way of doing this but I'm stuck on this from one hour and decided to share my frustration. I checked old examples TS, and all news examples which are so little compared with TS examples so I'm offering to convert some of the old onesto 1.0 because I'll gain some more knowledge too but first I must pass the atlas texture problem. Link to comment Share on other sites More sharing options...
ema99 Posted September 15, 2013 Share Posted September 15, 2013 read this posthttp://www.html5gamedevs.com/topic/1363-documentation/ Link to comment Share on other sites More sharing options...
rich Posted September 15, 2013 Share Posted September 15, 2013 Hey Mike, It's hard to tell if this is an animation or texture issue. Can you post the breakout.json file up here please? Also you can do: game.world.centerX rather than game.world.width / 2 You can also do: game.world.randomX too. Link to comment Share on other sites More sharing options...
Mike Posted September 15, 2013 Author Share Posted September 15, 2013 Hi Rich, First to say i checked the other topic but as i said: paddle.animations.add('paddle_big',[0,1,2,3,4,5], 10, true, false); This doesn't look as good solution to me, when once it worked with frame names. I've attached the files (the json is a .txt cause) breakout.jsonYou aren't permitted to upload this kind of fileIt's 100% valid json file, cause i checked it: http://jsonlint.com/ and also it works with the older phaser version. Also I tried: myGame.load.atlasJSONHash('tiles', 'assets/textureAtlas/breakout.png', 'assets/textureAtlas/breakout.json'); Cause the name implies something... still the same result... And tnx for the game.world.centerX TIPS i saw them in the examples but didn't bother to change since this part was the working one... Also I'm still digging this myself if I found something I'll sure post it here breakout.json.txt Link to comment Share on other sites More sharing options...
rich Posted September 15, 2013 Share Posted September 15, 2013 I wanted to see the json to find out if it was a hash or array, as array is the default type assumed, but you've got a hash file there so it wouldn't have found any frames when it was being parsed. You can still pass an array of filenames for an animation, that hasn't changed. I'll test it shortly. Link to comment Share on other sites More sharing options...
rich Posted September 16, 2013 Share Posted September 16, 2013 Ok I got to the bottom of it. The "useNumericIndexes" parameter was always being set to true, and of course in your case it should be 'false'. I've pushed this fix up as part of the 1.0.2 update. Also included a sample Breakout game Link to comment Share on other sites More sharing options...
Mike Posted September 16, 2013 Author Share Posted September 16, 2013 Cool tnx and respect for the fast fix and the breakout demo , I can confirm that everything is ok now and I'm continuing my work on the breakout game. Link to comment Share on other sites More sharing options...
rich Posted September 17, 2013 Share Posted September 17, 2013 Yeah it's a side effect of porting the code back from TypeScript - we've found a few more cases yesterday where optional booleans weren't being set correctly, and are fixing them as quickly as we can. Link to comment Share on other sites More sharing options...
Recommended Posts