Health Bar Issue

This forum is currently in read-only mode.
From the Asset Store
Health, Weapon & Rage Bars for your Games. Easy to use & Customize.
  • I did not like the way some of the previous health bars I created looked so I tried a new method. I created 35 animations of the health bar and just trimmed a tiny bit off of the right edge each time. Here is what I set:

    -global variable "health" 98 or greater --->animation "health decrease"

    --->animation set frame 1

    -global variable "health" equal to 97 --->animation "health decrease"

    --->animation set frame 2

    -global variable "health" equal to 96 --->animation "health decrease"

    --->animation set frame 2

    and so on.....(I pretty much just guessed how big the health bar would look at the current "health" variable and set "equal to" on every number from 0-100)

    The problem is that after some damage is dealt, frame 1 (FULL health) disappears completely and no other frames are ever set. I will try to upload a sample of what is happening later in the day.

  • I just found out that the frames do not completely disappear. The animation frames change position on the X and Y coordinates down and to the left until I can't see them.... even though I have the X and Y coordinates set and for that particular layer scroll is disabled...weird.

  • Why not just put your full health bar image in a Tiled Background and decrease the width? That'd be so so much easier than this system.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I've posted an example of several types of health bars here:

    Let me know if this doesn't do what you want.

  • You could just make a bar and set the width smaller and smaller as you get hit more and more.

    Ive used this in a few games and it looks really nice.

    Make a private variable "health"

    and set the width of the bar to always equal to health.

  • Why not just put your full health bar image in a Tiled Background and decrease the width? That'd be so so much easier than this system.

    I tried that way already and I just wanted to compare it to my other method. After messing around with health bars for a day I would have to say that Rich's example is probably the easiest and it can look good too. It's a pain to make a ton of animations. Thanks for the examples Rich

    By the way, I found out why the frames were moving around. It was because I did not set a hotspot for each frame!!! SIMPLE mistake.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)