Jump to content
  • Advertisement
  • entries
    6
  • comments
    32
  • views
    8788

Healthbars and such

Sign in to follow this  
Lactose

2027 views

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!

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!