Y
yuki
Guest
Hi i'm in bit of a pickle. Generally in the profiler, i'll let things that around 1-5% pass but 15% seems a bit to much. Right now i know what exactly is taking alot of processing and it goes back to my hp bar and drawing it.
I use a for loop to draw my HP bar based on the MaxHP and the current HP. I split my HP Bar into 3 Sections.
The Start The middle and the end. Which the Middle part is looped to accommodate the HP per 1 Pixel. But i also have an energy bar that does the same. After i draw the Bar i draw the actual health in which i also use the loop.
So in total i have around 4 loops
1 to draw the Bar
1 to draw the HP
1 to draw the Energy Bar
1 to draw the Energy Points
I'm wondering I am doing this correctly, or if there is a better way to do it, wondering if it would be better to just draw the Bar and the HP together perhaps? or will that still take the same amount of processing power. This is my code.
I use a for loop to draw my HP bar based on the MaxHP and the current HP. I split my HP Bar into 3 Sections.
The Start The middle and the end. Which the Middle part is looped to accommodate the HP per 1 Pixel. But i also have an energy bar that does the same. After i draw the Bar i draw the actual health in which i also use the loop.
So in total i have around 4 loops
1 to draw the Bar
1 to draw the HP
1 to draw the Energy Bar
1 to draw the Energy Points
I'm wondering I am doing this correctly, or if there is a better way to do it, wondering if it would be better to just draw the Bar and the HP together perhaps? or will that still take the same amount of processing power. This is my code.
Code:var i, var i2 var i3 var i4; //Drawing Health for (i2 = 0; i2 < global.hp; i2 += 1) { //Set 1 if global.hp>global.maxhp/4 { draw_sprite(HPBar, 0 ,view_xview[1]+33+(i2*2),view_yview[1]+9); } else { draw_sprite(HPBar, 1 ,view_xview[1]+33+(i2*2),view_yview[1]+9); } } // Symbol draw_sprite(HUD1,0,view_xview[1]-15,view_yview[1]-9) //2 draw_sprite(HUDSymbol,image_index,view_xview[1],view_yview[1]+1) //Drawing HUD for (i = 0; i < global.maxhp-6; i += 1) { if i < global.maxhp-7 { draw_sprite(HUD2, 0 ,view_xview[1]+40+(i*2),view_yview[1]+3); //11 } else { draw_sprite(HUD2, 1 ,view_xview[1]+40+(i*2),view_yview[1]+3); } } //Drawing EnergyBar for (i4 = 0; i4 < global.energy; i4 += 1) { if hudp=0 { draw_sprite(NRG, 3 ,view_xview[1]+38+(i4*2),view_yview[1]+23); } } //Drawing EnergyBar GUI if hudp=0 { draw_sprite(NRG,0,view_xview[1]+34,view_yview[1]+23) } for (i3 = 0; i3 < global.maxe; i3 += 1) { //Draw Energy HUD if i3 < global.maxe-1 { if hudp=0 { draw_sprite(NRG, 1 ,view_xview[1]+38+(i3*2),view_yview[1]+23); } } else { if hudp=0 { draw_sprite(NRG, 2 ,view_xview[1]+39+(i3*2),view_yview[1]+23); } }