News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Sprite transparency help

Started by Paladin, November 18, 2010, 02:26:06 PM

Previous topic - Next topic

Paladin

After much reading I am finally attempting to make a game.
However I am already having problems with drawing my sprite
so that only the colors above 0,0,0 are drawn.

See my example in the attached zip file.

"I am not young enough to know everything." - Oscar Wilde

BlinkOk

there is probably another way to do this but i loaded the sprite into my paint program and made black the transparent colour and it worked.

Paladin

I never read where the alpha channel needed to be zero.
I understood RGB(0,0,0) to be all that was needed for
a transparent sprite.  Thanks for your help!!!
"I am not young enough to know everything." - Oscar Wilde

Paladin

I normally use Paint.Net to edit images, but how to make
a color transparent was not easy to find.  To make a
color into a transparent background in Paint.Net select
the magic wand tool and then click on the background
color of the image and then hit the Delete key and save it.

Cheers.
"I am not young enough to know everything." - Oscar Wilde

BlinkOk

i am sure there is a way to do that in code and i'm even more sure kevin will be along soon to point it out.

kevin

#5
Yep,

Either mask the image

LoadFXIMage "triangled.png", 2
RgbMaskImage 2,$00ffffff



or set the maskcolour.


LoadFXIMage "triangled.png", 2
ImageMaskColour 2,argb(255,0,0,0)



  in this case, it'd be better to use the former..  Since that will make the maskcolour zero (argb(0,0,0,0) in the image by performing and bitwise AND against each pixel in the image.  This is helpful as most of the fillers have special opt's for this case.