Advertisement

Allegro: Sprite not drawing transparent.

Started by January 14, 2005 02:57 PM
1 comment, last by 23yrold3yrold 20 years, 1 month ago
hello, i've encountered a strange problem where my sprites just aren't being drawn transparent anymore, not alpha blending, but just basic masked blitting using the standard color rgb(255, 0, 255). i'll post the code which creates the images. the animations vector will have 8 animations in it, each animation element has 8 images. all 8 images in every animation element is the same, only the sprite is rotated. also the animation is loaded from a sprite sheet and a grab frame function takes the correct sprite, it all works except the images are rendering a black bacground not a masked one even though the sprite sheet is filled with rgb(255, 0, 255) around the sprites ... ive also tried using clear_to_color(image, makecol(255, 0, 255)) on every single bitmap i blit to but nothing works!!!

    // create animations
    animations.resize(8);
    for (int j = 0; j < 8; j++) {
        animations[j].images.resize(8); 
        for (int k = 0; k < 8; k++) {
            animations[j].images[k] = create_bitmap(32, 32);
            clear_bitmap(animations[j].images[k]);
            rotate_sprite (
                animations[j].images[k], 
                grabFrame(source, width, height, 8, k), 
                0, 0, itofix(j * 32)
            );
        }
        animations[j].frame = 0;
        animations[j].delay = 60;
        animations[j].start = 0;
        animations[j].direction = 1;
	}

j runs through each rotation and k runs though each frame in the animation ... i draw the sprite using draw_sprite(buffer, animations[index].getCurrentFrame(), x, y); where getCurrentFrame is a member of the anim class (animations vector is a vector of this class) BITMAP *getCurrentFrame() { return images[frame]; } ... i just dont know why this isnt working. thanks for any help.
Woop woop woop woop!
Did you set the color depth to 16 bpp, like this:

set_color_depth(16);
-----------------------------Play Stompy's Revenge! Now!
Advertisement
Doesn't seem to be anything wrong with the code you posted ...

Jesus saves ... the rest of you take 2d4 fire damage.

This topic is closed to new replies.

Advertisement