Nice looking Healthbar

0 favourites
  • 10 posts
From the Asset Store
HealthBar
$19.99 USD
Advanced, customizable, visual bars to present amounts of points such health, mana, stamina and more
  • Hi

    I want to make a custom continuous growing healthbar where the fill is more then just one color.

    And as you can see in the example below the healthbar should get a second fill layer in another color if the first one is full.

    dl.dropboxusercontent.com/u/61284640/healthbar.capx

    Is there a way to resize a sprite, without stretching it?

    Like "cutting" some pixels from the top of the sprite.

    Or does anybody have another idea how you can make this?

  • s there a way to resize a sprite, without stretching it?

    Like "cutting" some pixels from the top of the sprite.

    Yes if you use tiledbackground. Though to get it to grow from the bottom up you need to flip the sprite and rotate it so that the origin is at the bottom.

    healthbar.capx (r152)

  • Another way to "cut" sprites would be one of the blend modes, check out the blend modes example that comes with the program. Ofc a tiledbackground will work better in this case.

  • Thanks guys for your reply, but the problem is tiledbackgrounds doesn't support animations. So I could use a static custom picture but no animations in there. Like you see in the example I'd like to use a "flow-effect".

    The solution with blend modes is also great but only supports one fill of the healthbar, because "destionation out" uses the background as destination and no other sprite or background.

    An option so resize a sprite like a tiledbackground would solve the problem, but the sprite object just allows to scaling picture at the moment :S

  • I don't know if this will help or not, but you could try it.

    Instead of trying to resize the health bar, just create a new image and use that each time the health changes.

    So, you would create another sprite or something with another health bar, and set it to appear when the player gets hurt, for example.

    You'd have to set up some code to make the proper health bar visible or invisible as the situation calls for it.

    You'd have to use something like instance variables attached to the player's health to tell it which health bar to spawn.

    Ex: if health=3 then set healthbar3 to visible and rest to invisible.

    Anyway, I'm still new to C2, so I don't know if this helped or not, but hey.

  • Yeah you're right, it would be possible with a huge amount of different images.

    You don't need to make new sprites, you just can make a healthbar sprite with 3 frames, set animationspeed to 0 and set the current frame to players health.

    But in my case this would need a huge amount of frames (like 100 or more for each color) to make it smooth looking. <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Like this? (use spacebar to add to thermometer)

    thermometer

    This is done with a simple tiled background and one set height on spacebar released event.

  • Oh just saw you'd want animation possibilities.

    Just replace the tiled background object with another animationframe when needed. Destroy-create.

    or use opacity with another object behind it.

  • Using destination out or destination in should work perfectly too, just remember to set the layer to force own texture..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LittleStain Yes background would work but without animations.

    But "force own texture" is exactly what I was looking for!

    Thanks dude, works perfectly!!! <img src="smileys/smiley4.gif" border="0" align="middle" />

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