0 votes

Want to make a defeat animation using script, when the object is defeat, it scatter into fragments and disappear, can I use script to do this?
Thanks!

in Engine by (74 points)

1 Answer

0 votes
Best answer

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.

by (629 points)
selected by

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?

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.