

I've worked on a personal project in which I implemented exactly what you are looking for. Here is a small in-depth explanation of such code. Sample code solution is the very last one at the bottom of this answer. Does anyone else have experience with making something similar to this work?
Game maker studio health bar how to#
I am having trouble figuring out how to make each layer do this independently of each other.

Game maker studio health bar full#
To summarize, I need the gauge to remain full if the player's current HP is equal or greater than its respective range's maximum, be empty if it is less than its increment range's minimum, and scale between empty and full proportional to where hp_current lies between said layer's maximum and minimum values. So far I can get the first layer to work out just fine: draw_sprite_ext(sprite931, -1,0,0,(min(30, hp_current)/30),1,0,c_white,1) īut I am having some difficulty calculating the xscale argument for the layers representing hp_current values 31-40, 41-50, 51-60, etc. If you are familiar with the Mega Man Zero games, and how some bosses in that game had extra health represented in "layered" health bars that decremented independently of and sequentially to each other, I am basically trying to make that, just using a different health increment for all layers beyond the first. I want to represent this graphically by adding a different-colored overlay to the character's health bar for each additional 10 points added, with the last layer added diminishing before the ones behind it, proportional to how much of the last "extra" 10 points remains. I am currently working on a game in Game Maker Studio 2 where the player character is capable of increasing their maximum health beyond a starting value of 30, by increments of 10.
