At first I tried to make the progress bar update using only one object that would command everything (obj_Control
), linking to the global left released
event a script containing the draw_rectangle
function, but I got no results.
The Game Maker did not acknowledge any errors, but the progress bar did not update when I clicked on the created rectangles.
obj_Control (already without the draw_rectangle
event):
Because of this I decided to create 3 new objects (obj_Vida, obj_Fome, obj_Energia
), each containing a sprite and when each was clicked it would perform the action to update the progress bar:
obj_Vida:
scpt 1 => obj_Control.vida+=10;
(applies to self)
scpt 2 => draw_healthbar(120,100,240,120,vida,c_black,c_red,c_green,0,true,true);
(applies to obj_Control)
obj_Fome:
script 1 => obj_Control.fome+=10;
(applies to self)
script 2 => draw_healthbar(120,150,240,170,fome,c_black,c_red,c_green,0,true,true);
(applies to obj_Control)
obj_Energia:
script 1 => obj_Control.energia+=10;
(applies to self)
script 2 => draw_healthbar(120,200,240,220,energia,c_black,c_red,c_green,0,true,true);
(applies to obj_Control)
Room:
Room size => 360x640
Translate => vida/life, fome/hungry, energia/energy
What happens is that even dying of clicking on objects (obj_Vida, obj_Fome, obj_Energia
) nothing happens to the progress bar. I discovered that it is because of the event, it would have to be a draw event. I added one below the left released
event, but it did not work.
I apologize for any typing errors. I am not an English speaker and I had to translate everything. If something was not clear, please signal.
Thanks for everything.