Healthbars and such

Published May 20, 2017
Advertisement

Last time, I mentioned I had done some UI updates, but I didn't include anything to actually show what I had done.

Based on feedback, it seems like I should include some more visuals when it's appropriate, so here goes :)

This video shows a couple of different things:


  1. Currency and player health displayed as HUD elements.
  2. HUD elements updating in a "ticker" fashion -- quickly counting to the target value instead of snapping directly.
  3. Enemy healthbar.
  4. The enemy healthbar has an effect when damaged. It immediately displays the actual health, and additionally displays a depleting health indicator, where it (after a delay) gradually depletes from the previous health value to the new health value.
  5. Currency amount chosen at random, chosen from pre-defined min and max.


I spent more time implementing the tick functionality than I had wanted. Initially, I wanted something that worked for both ints and floats, but using C# in Unity, I couldn't get a single class to do what I wanted.

In C++ I would just have used a template class, but C#'s generic classes do not support arithmetic, which I would need.

In the end, I ended up creating just a single class for ints. If I need floats later on, I'll deal with that then, even if it means just duplicating the int class.

The same tick class drives both the currency/player health and the enemy healthbar drawing. For the HUD elements, I just use the ticking value directly, while on the enemy healthbars I use both the actual/target value and the currently ticking value.

The enemy healthbars are made up of 3 elements -- a black background/frame, a light green "filled" color, and a darker green used for "depleting" health.

It looked exactly like what I was aiming for, so happy with that. Given an eventual art pass, I might replace the single color with textures instead.

Next up: Turtle Shopa"c!

1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement