# Expansion limit of HP stick

I want to make HP upgradeable. At the beginning of the game, when the HP is 10, it will increase when the player level up, but after the HP bar grows, it gets so long that it goes out of the screen. Is there a way to keep the width constant?

Yes! You can do it with easy and basic math. First, decide of your full bar size. Then, simply set the size of the bar to that full size multiplied by the current HP divided by the max amount of HP:

Dividing the HP by the max hp gives you a number between 0 and 1 describing the ratio of hp to the maximum HP. Multiplying the target full width will, when you have the full HP, be 1 * Full width, so the full width, when there is no HP, 0 * full width, so no width, when at half life 0.5 * full width, so half the full width, and so on and so fort. It is basically a percentage.

Is there a way to make a tiled sprite or a sprite?

Yes, in Objects you can choose in Sprites (Animations: Can animate objects using events), or Mosaic (Just 1 Sprite, you extend the sprite this generate automatically more Mosaic)

Could you please explain a little more

I explained the basic math of percentages required to make a width scale in proportion to a variable maximum. I may have not posted a screenshot of events using the exact object you want to use but there’s obviously no reason why percentages would work differently when applied to another object since they are a mathematical concept and therefore totally unlinked to objects. Just use the corresponding action for the other objects.

thank you and sorry for my bad math