- Home /
Turning 2D Sprite Into Ashes
Hello everyone,
I have a lightning strike in my 2D game, all gameobjects are composed of sprites, what I want to do is turn any object hit by lightning strike to ashes, The problem is that some of these objects are characters that have animations and a lot of different equipment of different size.
So my question is, is there any way how can I convert sprite into ashes that will fall down and form ash pile?
Since I'm not good at scripting shaders, I don't know if it's even possible with shaders. But I have one ideea of how it could work, let's say I will have another sprite which will be a little black dot, then after anything is hit by lightning strike, I will spawn a lot of these little black dots all across the sprite surface. Is somehow possible to get the sprite surface in pixels for example?
Thanks
Answer by tanoshimi · Jul 26, 2017 at 05:15 PM
I suggest you look into "dissolve" shaders, which can be used to achieve various effects like this. Here's an example: http://www.codeavarice.com/dev-blog/tutorial-burning-edges-dissolve-shader-in-unity
I made one dissolve shader by myself, but that is not exactly what I want to achieve. I want to change the form (turn the character into ash that will fall down and form ash pile) and I don't think I can do that with shader. Still thank you.
Answer by Pigenator · Jul 26, 2017 at 05:29 PM
How about spawning a particle system affected by gravity? Unitys built in particles are very optimized and will probably give you the result you are looking for if you set them to 'affected by gravity'. Make the particle system a prefab and have your gameobjects spawn it if they die by lightning. GL :)
Is there a way to spawn each particle elements over the whole sprite?
Your answer
Follow this Question
Related Questions
Crop/Mask a Sprite on runtime 0 Answers
Render sprite on sprite ignoring alpha? 1 Answer
Why is my sprite not the original resolution? 2 Answers
I have an animaiton problem about sprite loading. 0 Answers
Sprite moving too far/fast 1 Answer