OblivionSkull21
Member
This question may seem a little confusing so I'm going to try to explain as best as I can.
I've started making healthbars for my battle system by using draw_healthbar(). I've got it working fairly well. When the enemy is hit, their health gradually drops like so:
However, for stylistic purposes, I'd like to do something along the lines of Kingdom Hearts 2's health depletion, where the health that has been taken away turns red and gradually fades like so:
Now, I've got the red to pop up and then turn to gray after some time has passed (no fade yet, but I can just use merge_color() to accomplish that). The problem, is that the red is taking up ALL of the background of the health bar and not just the health that it is being taken away from. Here's an example if it helps to understand what I'm saying:
The problem is that I don't want the red to take up the whole background but rather start just from where the green ends like how KH2 does it.
I'm using draw_healthbar() where the background color starts as gray, turns to red when depletion is triggered, and then turns back to gray after some time. I've come up with an idea but don't know how to accomplish it.
Basically, I want to draw a red rectangle for the depletion instead, over top of the health bar. This would require I know the exact x coordinates of where the green bar/remaining health stops and where it's destination will be when it finishes depleting. I would have the health bar's background ALWAYS be gray.
Here's what I have for the health bar code, without that idea implemented:
I've started making healthbars for my battle system by using draw_healthbar(). I've got it working fairly well. When the enemy is hit, their health gradually drops like so:
However, for stylistic purposes, I'd like to do something along the lines of Kingdom Hearts 2's health depletion, where the health that has been taken away turns red and gradually fades like so:
Now, I've got the red to pop up and then turn to gray after some time has passed (no fade yet, but I can just use merge_color() to accomplish that). The problem, is that the red is taking up ALL of the background of the health bar and not just the health that it is being taken away from. Here's an example if it helps to understand what I'm saying:
The problem is that I don't want the red to take up the whole background but rather start just from where the green ends like how KH2 does it.
I'm using draw_healthbar() where the background color starts as gray, turns to red when depletion is triggered, and then turns back to gray after some time. I've come up with an idea but don't know how to accomplish it.
Basically, I want to draw a red rectangle for the depletion instead, over top of the health bar. This would require I know the exact x coordinates of where the green bar/remaining health stops and where it's destination will be when it finishes depleting. I would have the health bar's background ALWAYS be gray.
Here's what I have for the health bar code, without that idea implemented:
GML:
pc = target_hp/target.starting_hp*100; //current hp divided by the amount they started with scaled by 100
draw_healthbar(x+start_x,y+start_y,x+end_x,y+end_y,pc,color,GREEN,GREEN,0,true,true); //draws according to the enemy's x and y coordinates
Attachments
-
22.5 KB Views: 0