• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

draw_sprite_part missing a colour

Sk8dududu

Member
I have a script that draws an energy bar. It draws the sprite based on how much of a variable "energy" I have. When I use a static image with 1 frame it works perfectly. But when I use another sprite that has multiple frames, it plays the animation, but it's completely missing a colour and I don't really understand why. It has the same yellow loading bar as the static image, just with lightning animation overtop of it. On the same layer. What could be preventing it from drawing the bar and only drawing the lightning animation?

Draw script for the bar:
Code:
function scr_draw_bar(xx,yy)
    {
    draw_healthbar(xx-(bar_width/2)-11,yy-8,xx+(bar_width/2)-11,yy+7,100*(red_energy/max_energy),c_black,c_red,c_red,0,false,false);
    draw_sprite_part(spr_ui_bar_fill,index,0,-3,ceil(bar_width*(show_energy/max_energy)),15,xx-(bar_width/2)-12,yy-8);
    draw_sprite(spr_ui_bar_outline,0,xx,yy);
    }
Script for setting up the bar
Code:
function scr_setup_bar()
    {
    max_energy = 550;
    section_size = 100;
    bar_width = 188;
    bar_height = 10;
    energy = max_energy;
    show_energy = max_energy;
    red_energy = max_energy;

    index = 0;
    }
I've tested having multiple frames for the static image to see if it would make anything invisible, it worked fine. It's gotta be something in the image editor making a colour transparent? or what? I also have a step event that increases the image_index by 0.5 every step. and it works because the lightning is animated.
 

Nidoking

Member
What version of Game Maker is this? I know the old versions used to use the lower-left pixel as the transparency color, so if that's what you're using, you might just be making the "missing" color transparent.
 

Sk8dududu

Member
What version of Game Maker is this? I know the old versions used to use the lower-left pixel as the transparency color, so if that's what you're using, you might just be making the "missing" color transparent.
Latest version. 2.3x
 
Top