Scale by number

0 favourites
  • 3 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • I'm planning on making a simple health bar that changes scale according to player's health. How can I make it to be at full length when player's health is 100 and completely invisible at 0? Also it should update smoothly, so some lerp(?) stuff should be there too. I'm really at loss with the expressions and whatnot.

    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
  • If for example full length is 200 then just always set the length to this:

    200 * health/100

    Or change 200 to whatever you want the max length to be.

  • I usually create a healthbar sprite...

    Then add a varaible.

    Healthbar = 100

    Then in events something like this.

    This set the healthbar sprite with to the Healthbar Variable which is 100, Using EveryTick to check this all the time.


    Healthbar Sprite width = Healthbar

    Then the next bit deducts 1 from the heathbar variable when ever you collide with an enemy, Which in turn makes the Healthbar Graphic/Sprite Smaller.

    PlayerSprite OnCollision with EnemySprite

    Healthbar = Healthbar -1

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