Jump to content

Problem display name of current frame


onedkr
 Share

Recommended Posts

Hello,

I've some problems with basics animation on phaser 2.2.2 :
 
I created an animation :
 
game.load.atlas('bodyPlayer', 'img/body.png', 'data/body.json');...player = game.add.group();player.health = 100;game.physics.arcade.enable(player);player.enableBody = true;bodyPlayer = player.create(140, GAME_HEIGHT - 255, 'bodyPlayer');bodyPlayer.animations.add('normal', [0,1]);bodyPlayer.animations.add('run', [2,3,4]);

After in the update function :

bodyPlayer.animations.play('run', 5);console.log(bodyPlayer.animations.name);console.log(bodyPlayer.animations.currentFrame.name);

Here the result :

 

main.js:190 run
main.js:191 003 - run1.png
main.js:190 run
main.js:191 004 - run2.png
main.js:190 run
main.js:191 005 - run3.png
main.js:190 run
main.js:191 Uncaught TypeError: Cannot read property 'name' of undefined
 
It made one loop, display correctly the names of all the frames of this animation, stop and show this error.
 
I attach my Json File made with Texture packer (Json Array).

 

Thank you for your answer and sorry for my english :/

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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