How do I make a health bar?

0 favourites
  • 4 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • I wanted to make Dishonored-style health bar and decicded just to separate it into different frames and change them as players health goes down or up. But for some unknown reason it doesn't work. I tried lots of ways and none of them work as I want. I just have no idea at all. I'm completely new to construct.

    Link to my file below:

    drive.google.com/file/d/1fljRsx0ijNLwIxTAM55Iro9rvwwTZbxQ/view

    Tagged:

  • What I’ve done similar to what you mentioned is create a health bar sprite of 3 frames. Frame 0 Has 3 Full Red Hearts. Frame 1 has 2 full red hearts. Frame 2 has 1 and frame 3 has blank or no hearts.

    Then set Frame Speed to 0 so the animation doesn’t cycle through.

    In the Event Sheet, I created a Global Variable calling it Health.

    An Event was created that when I got attacked or set to is Flashing I subtracted 1 from the Health Global variable.

    The next event I set the Compare Value.

    If (Global variable) Health = 3 - Add action: Set the Health sprite Frame to 0

    Then created repeating events:

    If Health = 2 set Health sprite Frame to 1

    Health = 1 set sprite frame to 2

    Health = 0 set sprite frame to 3

    If Health = 0 add action: Restart Layout or whatever you intend to do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My problem is that I'm a free user and I can't have lots of events. I need to save as much events as possible. Sure it would be MUCH easier but I'll lose lots of events that's for sure. Is there any other way?

  • This might work:

    Add an Event: Is Player on Collision with another object (Enemy) (Just using Player and Enemy as Example Objects you can create)

    Add a Sub Event: Health (Animation Sprite you created) - Compare Frame < (less than) 4 frames (or whatever number of frames you have.

    Add Action: Health sprite: Set Frame - ok type in the white field for Frame number: Health.AnimationFrame +1

    (I said Health as that is the name I gave the health bar sprite. If you have it a different name, you have to use that. It should auto appear as you type same with AnimationFrame.)

    One Event. Try it. Good luck.

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