cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.16k stars 7.05k forks source link

setAnimation bugs, cannot change animation #20690

Open pipe1404 opened 2 years ago

pipe1404 commented 2 years ago

Steps to Reproduce:

  1. set up an animate action on sprite using an animation of 4 sprites(in my case).
  2. call setAnimation using another animation of 6 sprites or more.
  3. build and run then it will cause out_of_range exception at _splitTime in Animate::update

I think that _splitTime is not updated to match new animation timing, so it causes an exception on new animation.