Jump to content

Animation manager "useNumericIndex" parameter not working?


ForgeableSum
 Share

Recommended Posts

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 undefined

phaser.js: line 32769

 
 
Why is this not working?  :huh:
 
 
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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