Miu Posted March 20, 2014 Share Posted March 20, 2014 Hi there, I tried to add multiple animations in one player, here is how i wanted to do: in preload function:game.load.atlasJSONArray('megaman_left','./assets/charset/left.png','./assets/json/left.json'); game.load.atlasJSONArray('megaman_idle','./assets/charset/idle.png','./assets/json/idle.json'); game.load.atlasJSONArray('megaman_right','./assets/charset/right.png','./assets/json/right.json');in create function: player = game.add.sprite( 30, 200, 'megaman_idle'); player.animations.add('run_right'); player.animations.add('idle'); player.animations.add('run_left');in update function: if (keytouch.left.isDown) { player.animations.play('run_left',13,true); player.body.velocity.x = -350; } else if (keytouch.right.isDown) { player.animations.play('run_right', 13, true); player.body.velocity.x = 350; } else { player.animations.play('idle', 2, true); }And, as i expected, this is only playing idle animation, even if i press one of the keys. So here is my question : can I add multiple animations with multiple png and json files in one player object? i looked into the doc, can't find something like player.animations.add(...) to load with multiple files. Thank you for your help Link to comment Share on other sites More sharing options...
rich Posted March 21, 2014 Share Posted March 21, 2014 No this isn't possible yet. Link to comment Share on other sites More sharing options...
Recommended Posts