In the past day I’ve added a rotating Asteroid that when hit will start the enemy spawn routine. I’ve also added a thruster animation to the Player ship. It looks really cool. Nothing too new in doing so. Just a lot of the same animation patterns we’ve used previously.
In the name of emersion I thought it would be cool to add a visual representation when the player takes a hit by adding a fireball with a smoke trail.
I start by dragging the first sprite image from the animation into the hierarchy. As we’ve done before I created an animation from it. I and then dragged it into the scene view. ( I made a prefab of each) As a child of the Player Object. I then duplicated it and renamed it Right_Damange and Left Damage respectively.
From the inspector for each I then make sure that they are turned off by default. Now comes the fun part. How do I want this behavior to work and where should I turn it on?
Easy! So everytime I take a hit I need to activate the appropriate Animation. This happens in the public void Damage() method. This is what my implementation looks like.
And finally here’s what it looks like in engine. Check back tomorrow when I’ll be discussing the topic of post processing in Unity.