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.

--

--

--

Unity Game Developer and C# Programmer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Motion Layout: Card Shuffle Animation

Best Markdown Editor For Mac 2018

Stop using !! and embrace {{ }}

A Guide to Web Scraping and Data Analysis with Python

Libraries and frameworks used in this stack

INDUSTRY USECASES OF OPENSHIFT

Django Heroku server setup

Group Anagrams

3 Interesting C# Features

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Clark

Matthew Clark

Unity Game Developer and C# Programmer

More from Medium

“Game Feel”: The Impression Of Weight

Cinematography In Unity — Cameras In Cinemachine

Adding a camera shake effect

Unity : Cinemachine and Timeline (Part III)