ForgeableSum Posted December 19, 2014 Share Posted December 19, 2014 So I've got the code: player.animations.add('runNE', [1,2,3], 15, true, true); In the JSON (where the frames are defined) I have: {"filename": "1","frame": {"x":256,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}},{"filename": "1","frame": {"x":320,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}},{"filename": "3","frame": {"x":384,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}}The animation works fine just like that. But when I switch the final parameter to false so I can use strings instead of numbers to reference the frames: player.animations.add('runNE', ['NE1','NE2','NE3'], 15, true, false);{"filename": "NE1","frame": {"x":256,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}},{"filename": "NE2","frame": {"x":320,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}},{"filename": "NE3","frame": {"x":384,"y":64,"w":64,"h":64},"rotated": false,"trimmed": true,"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},"sourceSize": {"w":64,"h":64}}I get an error in the console: Uncaught TypeError: Cannot read property 'x' of undefinedphaser.js: line 32769 Why is this not working? Link to comment Share on other sites More sharing options...
eguneys Posted December 20, 2014 Share Posted December 20, 2014 Phaser.Animations suck, I asked a similar question and nobody answered: http://www.html5gamedevs.com/topic/7239-phaser-animation-playback-examples/, I suggest dig into code and fix it yourself. Link to comment Share on other sites More sharing options...
Recommended Posts