Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Issue with JSONArray Animation


Connormcwood
 Share

Recommended Posts

Hi I have come to a dead in, I have attempted various research on platforms such as google, YouTube and Lynda however to no avail.

I have used TexturePacker to create a spritesheet assiociated with JsonArray so that I can incorporate animations within my project however I am met with this Index error which is assiociated with the first line of code:

		this.sprite.animations.add('walk', Phaser.Animation.generateFrameNames('Slide', 1, 10), 10, true, false);
		this.sprite.animations.play('walk');

I have preloaded the required JsonArray and Image path within the preloader by doing the following:

		this.load.atlasJSONArray('robot', 'src/images/robots.png', 'src/images/robots.json');

And an example of this .json file is like this:

{
	"filename": "Slide1.png",
	"frame": {"x":3574,"y":361,"w":409,"h":356},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":31,"y":170,"w":409,"h":356},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide2.png",
	"frame": {"x":3572,"y":2665,"w":406,"h":358},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":34,"y":168,"w":406,"h":358},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide3.png",
	"frame": {"x":3561,"y":1412,"w":403,"h":360},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":37,"y":166,"w":403,"h":360},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide4.png",
	"frame": {"x":3084,"y":1781,"w":400,"h":361},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":40,"y":165,"w":400,"h":361},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide5.png",
	"frame": {"x":3159,"y":1412,"w":400,"h":361},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":40,"y":165,"w":400,"h":361},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide6.png",
	"frame": {"x":2763,"y":2660,"w":400,"h":360},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":40,"y":166,"w":400,"h":360},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide7.png",
	"frame": {"x":2763,"y":3022,"w":400,"h":360},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":40,"y":166,"w":400,"h":360},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide8.png",
	"frame": {"x":3165,"y":2982,"w":402,"h":359},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":38,"y":167,"w":402,"h":359},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide9.png",
	"frame": {"x":3165,"y":2622,"w":405,"h":358},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":35,"y":168,"w":405,"h":358},
	"sourceSize": {"w":567,"h":556}
},
{
	"filename": "Slide10.png",
	"frame": {"x":3572,"y":2306,"w":407,"h":357},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":33,"y":169,"w":407,"h":357},
	"sourceSize": {"w":567,"h":556}
}],

(Manually Rename Filename from Slide (1) to Slide1 in order to work however still met with an error)

I have tried to find videos which will help me with creating an animation spritesheet with Json but every resource I follow I still get this error. If my mistake is not obvious feel free to point me to a good resource.

Regards,
Connor

 

Solved:
No where mentioned extension had to be removed. Eventually got it working.

Edited by Connormcwood
Solved
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...