Bapt Posted July 30, 2014 Share Posted July 30, 2014 Hi, i'm new with Phaser and i have a problem. I can't figured out why i can't change the framerate of my animation.My idea was simple, when my player's speed goes above some speed, i want his animation to go faster.So for the moment in my update i have this : player.body.damping = 0.5; if (player.body.velocity.x < -1 && player.body.velocity.x >-10) { player.animations.play('right',1); } else if (player.body.velocity.x < -10) { player.animations.play('right',50); } else { player.animations.stop(); player.frame = 12; } cursors.right.onDown.add(move); function move () { player.body.thrust(10); } if (cursors.up.isDown) { player.body.moveUp(50); } else if (cursors.down.isDown) { player.body.moveDown(50); }I tried to stop the animation before doing the play but i don't know how to stop just once so it's stopped all the time.Is there a way to achieve what i want ? Link to comment Share on other sites More sharing options...
lewster32 Posted July 30, 2014 Share Posted July 30, 2014 You need to alter the delay property of the animation like so:player.animations.getAnimation('right').delay = 50Just set it off playing and use that property to control how fast it plays. Link to comment Share on other sites More sharing options...
Bapt Posted July 30, 2014 Author Share Posted July 30, 2014 That's exactly what i wanted to do, i saw the delay function but i didn't know how to pick the right animation, i just didn't see the getAnimation. Thank you for the help, now i just have to deal with the trhust thing who don't reset when the speed slow down, but this is another question and i will do some research through the documentation.Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts