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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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