Steps:
- First, make an image that will be the blood splash, something like this:
- Then you should add it to your game scene, put it in front of the camera (this will be easier in 2D games because you can just put it in front of it in 3D games you should work on camera space).
- Finally you must have type a few lines of code to controllate the blink effect (I enable it when the Hp of the player goes down of 50 points):
- I just use a sin function and limit it between 0 and 0.25.
//Tint Screen if(curHealth <= 50) { tintScreen.color = new Color(tintScreen.color.r, tintScreen.color.g, tintScreen.color.b, ((0.25f * Mathf.Sin(Time.realtimeSinceStartup * 5)) + 0.25f) / 2); }
The result is really cool and you can adjust the speed (the number 5) or the range!
Hope it was usefull!