- Изменено
[cocos2d-x] A small question about spine animation
Hi there, I'm using cocos2d-x 2.2.3 with lasted spine runtime. My project has one character called Nik runs some animations. If the first animation is running and I want to force stop it then make Nik running the second animation, the problem is Nik will run the second animation with the image is stopped at the first animation.
For an example, in the first animation, Nik throws a grenade and his hand will change from open to close. Then I make Nik running the second animation called "walk" with his closing hand. But if when Nik's hand still open, I force stop his first animation by using 'clearTracks()' method and run the second animation. The problem occurs Nik walks with openning hand. I know it caused by the 'clearTracks()' method. Is there any way to make an animation stop and remove successfully before running another animations?
Any help would be appreciated!
You need to have a slot key set for the hand so it knows which slot attachment to switch back to when you change your animation at runtime. One way you can get around this in some cases is to use setSlotsToSetupPose
when switching animations, this will change your image back to what you are using in your Setup Pose.
I hope this helps.
It works like a charm! Thanks for your supports. Cheers!
- Изменено
Hi there, I'm using cocos2d-x with lasted spine runtime. My project has more than one spine animations. If the first animation is running and I want to force stop it then start second animation.I force stop the first animation by using 'clearTracks()' method and run the second animation. Is there any way to make remove and release from memory before running another animations?
Any help would be appreciated!!!
"run animations in each page"? What does that mean?
Also what do you mean by "stop and remove successfully"?
When you call setAnimation
while an animation is playing on the same track, it automatically removes the previous animation from the AnimationState's list of playing animations.
Calling clearTracks
doesn't free up memory.