devx123x Posted April 27, 2015 Share Posted April 27, 2015 (edited) I am trying to run an animation in phaser. I created the sprite and added the animation with the following code:player = game.add.sprite(game.world.centerX,game.world.centerY,null); // parent spriteplayer.legs = game.add.sprite(50,50,'soldier',16); // child spriteplayer.legs.anchor.set(1,1); //anchoring child spriteplayer.legs.animations.add('walk',[16,15,14,13],10,null,false); // The animation I want to playplayer.addChild(player.legs); // adding sprite as childI run the animation with the following code:player.legs.animations.play('walk');The version of phaser I am using is 2.3, the build with arcade physics only. I am certain the issue is not with the spritesheet or the json atlas. Edit: I just console logged player.legs.animations.currentAnim.isPlaying and it says true!index.html Edited April 28, 2015 by devx123x Link to comment Share on other sites More sharing options...
rich Posted April 27, 2015 Share Posted April 27, 2015 Boil it down to the basics - i.e. does the leg animation work on its own with nothing else at all? (not as a child of another sprite, but just on its own) Link to comment Share on other sites More sharing options...
devx123x Posted April 28, 2015 Author Share Posted April 28, 2015 No, it does not. I uploaded a few screen shots of it in console.log. Link to comment Share on other sites More sharing options...
rich Posted April 28, 2015 Share Posted April 28, 2015 Upload your soldier.json + png files here. I suspect it doesn't use frame numbers, but frame names. Seeing this will confirm though. Link to comment Share on other sites More sharing options...
devx123x Posted April 29, 2015 Author Share Posted April 29, 2015 Upload your soldier.json + png files here. I suspect it doesn't use frame numbers, but frame names. Seeing this will confirm though.Thank you so much Rich, this solved my problem. The funny thing was that I was able to create the sprite with a frame number and it worked fine. Link to comment Share on other sites More sharing options...
Recommended Posts