How do I Make a Health Bar Go Down Normally?

0 favourites
  • 5 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Sorry if this question was asked already, but I haven't found one that answered this.

    How do you make a health bar (horizontal or vertical) decrease in length from max length to 0? I'm trying to make a platformer game of some sort, and it requires a health bars for the player and enemies. Every time I make a health bar lose value (or "health"), it loses its length on BOTH sides of the bar, meaning it looks odd when the entity it is for loses health. I want ONLY the top (for vertical) or the left (for horizontal) side of the bar to shorten until the bar depletes. Plus, it should work for bars that have different colors for design, or bars that have outlines without making them look stretched. I've been stuck at this for a while now, and I can't figure out how to solve this.

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ezgaming420

    They are many ways to do it, here are some ideas to help you started, I hope it helps

    https://www.dropbox.com/s/jeq49flgj1wrq1w/Create%20Healh%20bars%20to%20multyple%20instances2.capx?dl=0

  • It's because it sets the size and centres the object on its origin. There are many ways to do it, you could resolve it by moving the origin image point to the side of the bar that should remain where it is, then you'll see the size decreasing from the other side. That's how I've done it in the past.

  • Yes, if you want the bar to only lose health from one side, set the origin point of the sprite to be at the opposite end and then set the object's width (for horizontal bars) or height (for vertical) to decrease in line with the health variable.

  • Thanks everyone! I didn't know before that the origin point affects that I'm still trying to learn everything in Construct 2.

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