Damage VFX Using Animated Sprites in Unity

Every time our Player loses a life, we should indicate this with VFX as well as our UI. For each life lost, we can “blow an engine” on each wing.Let’s position these two damage sprites as child objects of our player.Both will use the same animation and…


This content originally appeared on Level Up Coding - Medium and was authored by Calum Slee

Every time our Player loses a life, we should indicate this with VFX as well as our UI. For each life lost, we can “blow an engine” on each wing.

Let’s position these two damage sprites as child objects of our player.

Both will use the same animation and controller so let’s create one and access it from both game objects.

In our Player script we need to create a variable to access our game objects. We can use an array to store them, as we may also want to add more damage indicators in the future. In our TakeDamage method we can use a switch statement to run the code for each amount of lives, rather than the if statement we had checking if we were dead. In this, we can simply use .SetActive to turn on our gameobjects accordingly.

Now, as our live’s decrease, our ship will appear to take more damage.


Damage VFX Using Animated Sprites in Unity was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Calum Slee


Print Share Comment Cite Upload Translate Updates
APA

Calum Slee | Sciencx (2021-05-12T17:06:07+00:00) Damage VFX Using Animated Sprites in Unity. Retrieved from https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/

MLA
" » Damage VFX Using Animated Sprites in Unity." Calum Slee | Sciencx - Wednesday May 12, 2021, https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/
HARVARD
Calum Slee | Sciencx Wednesday May 12, 2021 » Damage VFX Using Animated Sprites in Unity., viewed ,<https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/>
VANCOUVER
Calum Slee | Sciencx - » Damage VFX Using Animated Sprites in Unity. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/
CHICAGO
" » Damage VFX Using Animated Sprites in Unity." Calum Slee | Sciencx - Accessed . https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/
IEEE
" » Damage VFX Using Animated Sprites in Unity." Calum Slee | Sciencx [Online]. Available: https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/. [Accessed: ]
rf:citation
» Damage VFX Using Animated Sprites in Unity | Calum Slee | Sciencx | https://www.scien.cx/2021/05/12/damage-vfx-using-animated-sprites-in-unity/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.