I don’t know of an easy way to randomly divide a 2d sprite into smaller sprites using a script. However, what you can do is make each fragment its own sprite. During normal animations, the fragment sprites can be hidden. When the defeat happens, hide the overall sprite and show the fragments, then scatter them.
Thanks for your reply, so what I could do is made the pieces and scatter animation at first, when defeat play the animation or I can just move the pieces randomly using script?
hsjaaa | 2019-02-16 11:57
Yep, either way. There’s also the possibility of using a particle system here, or perhaps making the fragments physics objects, etc. lots of different approaches that could work.