How do I Create a 20/20 Health Bar

0 favourites
  • 5 posts
From the Asset Store
20 high-quality 2D monsters. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • My game needs a HP Ratio like 20/20 is full health, 10/20 is half etc. i would like to minimize the use of text boxes and global variables as much as possible, im also wondering if theirs a way to do it with just one text box and one global variable. Thanks for your time guys!

  • Do you want to show the health bar or just text?

    Healthbar

    If you want your max health bar to be eg 250px

    Your on top health bar should be 250 / 20 * amount of current hp.

    So 5hp will be 62.5px wide to show the hp

    Text

    Global variable = current hp

    Set text to "current hp" & "/20"

  • sqaure image object

    variables

    sqaure.maxhealth

    square.currenthealth

    *total bar width when full = 100 pix

    set square width to (100 * (sqaure.currenthealth / square.maxhealth))

  • Not a bar sorry, just the text. with every level i would like to add an increase for the capacity

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want the max hp to change with level, you need either a well defined function or another variable for it. eg.

    Set text to HP & "/" & MaxHP[/code:2c5eej61]
    If you don't want to use another variable, use something like [code:2c5eej61]Set text to HP & "/" & (15 + 5 * Level)[/code:2c5eej61], which is of course more limited.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)