Creating a Visual Damage Representation for the Player
When the player is hit, it is expected that damage indicators will appear. In this tutorial I will go over how to add damage effects to wings of a spaceship.
- The first thing you can do is animate the damage effect. I have created a tutorial for that so you can go check that out if you do not already know how to animate sprites. <insert link to sprite animation tutorial>
- Once you have the animation created attach two of the effect to your player. You can take the first sprite of the animation two times and attach the animations to those. This will allow you to rename them.
- You will want to adjust both to the wings and correct the size to make it proportional to the player.
- Make sure you disable the effect in the hierarchy so that we can control when they activate in the player script.
- Go to the player script and make a variable to hold the effects
- Go to the method that controls the player health. Add logic so that when the player loses 1 live one effect will come on Or when the player is hit twice both effects will come on.
- Go back to Unity and drag the effects into the variable slots.
- Now you have a damage effect for the player.