borispulido Posted November 6, 2015 Share Posted November 6, 2015 Hi Guys! Well thats the problem i have to solve, because I need to continue my animation loop from a specific frame (the last frame when i stop animation from an onDown event ) i can get my animation last frame, but animation.play dont receive that parameter to start the loop from that frame. So what i can do? I've been thinking change the order of frames, ordering a new array, beginning with that specific frame then update the frames array then play animation.....but i dont know just an idea I just had. sorry for my English, google translator at its best. Cheers! Link to comment Share on other sites More sharing options...
shohan4556 Posted November 7, 2015 Share Posted November 7, 2015 if you want to animate frame from 5-10 frame(assume that your spritesheet have 1 to 10 frames) then try something like this myanimations.add('heroRun',[4,5,6,7,8],true); // frame start from 0.myanimations.play('heroRun'); Link to comment Share on other sites More sharing options...
borispulido Posted November 7, 2015 Author Share Posted November 7, 2015 sorry let me explain better with a example: If you have a jetfighter whose animation roll right with a onDown event, your animation.add for roll havethe array frames [0,1,2,3,4,5]. so when you press RIGHT then animation.play begins so starts looping from 0, so if the middle of the roll you release the RIGHT key, then animation.stop stop your animation, thats fine your jet stays in that position frame (for example frame 3), let says in half roll, good........but this is the problem, if you want to CONTINUE that roll to finish the "turn" when you press RIGHT again the animation start from the beginning not from the frame where it left off. jmp909 1 Link to comment Share on other sites More sharing options...
jmp909 Posted November 7, 2015 Share Posted November 7, 2015 http://www.html5gamedevs.com/topic/6895-playing-animation-from-certain-frame-then-loopong/ Link to comment Share on other sites More sharing options...
borispulido Posted November 8, 2015 Author Share Posted November 8, 2015 don´t work for me, says "ship.animations.currentAnim.setFrame is not a function" ship.animations.play('E');ship.animations.currentAnim.setFrame(14, true); Link to comment Share on other sites More sharing options...
jmp909 Posted November 8, 2015 Share Posted November 8, 2015 Try .frame=14 maybe?https://github.com/photonstorm/phaser/blob/db641ca82e608470bd7902de3447d048d9715ab5/src/animation/AnimationManager.js Link to comment Share on other sites More sharing options...
borispulido Posted November 9, 2015 Author Share Posted November 9, 2015 sorry jmp909only freeze animation in that frame, dont start the loop Link to comment Share on other sites More sharing options...
Recommended Posts