Antoine Farel
Member
Hi guys! I'm struggling on a problem that I have for serval days:
I want to do a bar that fills over time up to desired score (It's a vertical bar that fills to the bottom to the top). At the begining, a mini game is playing. During it, my bar is empty. After 5 seconds, the minigame ends, and here I want my bar to fill up little by little until the player's score. I can't use the
In my draw event, I got this line of code:
For bar_top and bar_height, I use this part of code:
Alarm 1 (Part):
Alarm 2 (Part) (i is set to 0 in the create event):
Here, I got... issues, the sprite isn't displayed with that code, and I don't really know where I fail, maybe because of an incorrect use of
If you have any question that might help me, don't hesitate! Thanks.
I want to do a bar that fills over time up to desired score (It's a vertical bar that fills to the bottom to the top). At the begining, a mini game is playing. During it, my bar is empty. After 5 seconds, the minigame ends, and here I want my bar to fill up little by little until the player's score. I can't use the
draw_healthbar
function because my bar has a special sprite. Instead, I use the draw_sprite_part
function. I got an alarm that activates after 5 sec for the end of the mini game, and I tried to do someting with an alarm that activates itself every .1 seconds to fill my bar a little by little.In my draw event, I got this line of code:
GML:
draw_sprite_part(spr_bar_fill, 0, 0, bar_top, fill_width, bar_height, xx, (1-scr_percentage) * fill_height);
fill_width
is the width of my sprite, not really important.For bar_top and bar_height, I use this part of code:
Alarm 1 (Part):
Code:
alarm[2] = .1 * room_speed
Code:
if i < scr_percentage * fill_height {
i++;
bar_top = fill_height - i;
bar_height = i;
alarm[2] = .1 * room_speed;
}
scr_percentage
is my score in percent (there is a max score possible)Here, I got... issues, the sprite isn't displayed with that code, and I don't really know where I fail, maybe because of an incorrect use of
draw_sprite_part
or the pseudo "for" statement done with the alarms.If you have any question that might help me, don't hesitate! Thanks.
Last edited: