Black Sprite

Blitz3D Forums/Blitz3D Beginners Area/Black Sprite

Terry B.(Posted 2008) [#1]
I want to have a black sprite, its just a dot, Im going to want to use it for a bullet hole. The problem is though, when I load it, the black part gets edited out. Is there anyway to fix this and mask the red part and not the black dot in the middle?


Ben(t)(Posted 2008) [#2]
the bullet holes I use are black in the middle and white on the outside one of the sprite commands


Terry B.(Posted 2008) [#3]
Thanks, after making it white outlined it just need to be entityblend 2 to work


Ross C(Posted 2008) [#4]
That or change the mask colour :o) See my code archive entries for that.


IPete2(Posted 2008) [#5]
Terry,

Use a small 32 x 32 transparent png with a black mark (for your bullet hole) in the centre, as your sprite, and have the flags set to 3 when you load it. This will give you a floating black 'hole' which you can position for the bullet holes. BTW I mention png as thats what I'd use, but you could use a targa (tga).

IPete2.


jfk EO-11110(Posted 2008) [#6]
Or think about to use DXT3 or DXT5 for masked or alpha sprites/testures. It does not only allow to use alpha independently from color, but also features smoothed mask outlines. Using Alpha for Bullets may be bad, and additional or multiplying blendmode may hide the sprite on white or black grounds, so masking may be the best choice IMHO.
"Photoshop" or "The Gimp" as well as some other Apps can save DXT (aka DDS).


H. T. U.(Posted 2008) [#7]
Ross C is right, this is a classic case of changing the mask color. Use the MaskImage command and set the color to the red you want to get rid of. This fixes both problems.


Ross C(Posted 2008) [#8]
Maskimage won't work on textures i'm afraid. You'll need to loop through every pixel/texel and set it's alpha value, that what my function does, except it checks for colours too.


Yo! Wazzup?(Posted 2008) [#9]
You could try making it, instead of black, like RGB 1, 1, 1, because then people would think its black but you don't have to worry about masking it. Even better, An RGB value of 1, 0, 0.


Ross C(Posted 2008) [#10]
That's what i'd do :D Make sure your not using 16 bit graphics mode though :o)


nerdy_kid(Posted 2008) [#11]
Ross C -
Maskimage won't work on textures i'm afraid.


wouldn't it work if you loaded it as a 2d image, masked it, then saved it with CreateTexture?


Yo! Wazzup?(Posted 2008) [#12]
It might, but having your texture be RGB 0,0,1 is much easier, IMO.